I have a Controller with syntax like this:
public class CrudController<TEntity> : Controller
Now if I need a CrudController
for Entity User
, I just need to extend the CrudController
like this
UserCrudController : CrudController<User>
Its working just fine. But, the thing is, the UserCrudController
is simply empty. Also, there are some other CrudControllers
which are empty too.
Now, I am looking for a way to avoid writing the empty crud controllers. I simply want to create Instances of CrudController
with appropriate generic argument. Perhaps by a strict naming convention as described bellow.
- The URL will be like:
@Html.ActionLink("Create", "UserCrud")
- When the URL will be received, it will try to locate the controller named
UserCrud
(The default thing) - If it fails to locate
UserCrud
,Crud<User>
will be created.
Now, I can do the things I want to do. But exactly where do I do these? Where is the url parsed in mvc?