title: Attribute Routing in base class actions inherited the Controller MVC C#
body: <p>I am using the following structure where I have used the following base class structure to implement the view.</p>
  
  <pre><code>public class Entity1Controller : ClassHelper&lt;Entity1, Enitty1ViewModel&gt;
  {
      public Entity1Controller(IObject obj1&lt;Entity1&gt;, IObject1 obj2)
      {
      } 
  }
  
  public abstract class ClassHelper&lt;TEntity&gt;, TEntityViewModel&gt; : ClassUtility&lt;TEntity, TEntityViewModel&gt;
  {
      public readonly IObject obj1&lt;TEntity&gt;;
      public readonly IObject1 obj2
      public ClassHelper(IObject obj1&lt;TEntity&gt;, IObject1 obj2)
      {
           this.obj1 = obj1;
           this.obj2 = obj2;
      } 
  }
  
  public class ClassUtility&lt;TEntity, TEntityViewModel&gt; : Controller
  {
      public readonly IObject obj1&lt;TEntity&gt;;
      public readonly IObject1 obj2
      public ClassHelper(IObject obj1&lt;Entity1&gt;, IObject1 obj2)
      {
           this.obj1 = obj1;
           this.obj2 = obj2;
      }
  
      public ActionResult Index()
      {
          return View();
      }
  
  
      [Route("Add")]
      [Route("Edit/{id:int:min(1)}")]
      public ActionResult AddorEditEntity(int id = 0)
      {
          if (id &gt; 0)
          {
              //some code and get the entity
              return PartialView("_AddorEditPartial", entity);
          }
  
          return PartialView("_AddorEditPartial", new TEntityViewModel());
      }
  
      //Other Methods
  }
  </code></pre>
  
  <p>The Webpage at www.localhost.com/Entity1 give result of Index view [as It should be], but When I tried to search for url with attribute routing eg. <code>www.localhost.com/Entity1/Add</code> or <code>www.localhost.com/Entity1/Edit/1</code> or <code>www.localhost.com/Entity1/GetAll</code> and so do other methods, They do not omit any result. </p>
  
  <p>If I use the convention routing in my address [rather than <code>www.localhost.com/Entity1/Add</code>, using the <code>www.localhost.com/Entity1/AddorEditEntity</code>], This application render the view and show the web result.</p>
  
  <p>If I define the same methods directly from Controller i.e. using inherit the Controller directly to <code>Entity1Controller</code> [for ex. <code>public class Entity1Controller : Controller</code>, rather than base inheritance model shown above], the attribute routing works file without hitch.</p>
  
  <p>I tried to google it, and come to know able <code>DefaultDirectRouteProvider</code> but this works only for <code>ApiController</code>. I want to use the same in MVC application [i.e. <code>Controller</code>]. 
  so that when I access the AddorEditEntity method by following address <code>www.localhost.com/Entity1/Add</code> it should render the view.</p>
  
  <p>Please advise whether this is possible.</p>