May be a stoopid question:
I have a number of reference tables in an application database, which I want to be updated from my MVC3 site.
I can create a “ReferenceController” which has CRUD methods for each of these tables
or
I can create a “EntityController” which has CRUD methods JUST for this one reference table (entity).
Not sure if there is a sensible pattern to follow for this?
EDIT:
If I do create a controller per Aggregate, then how do you name the methods on the controller?
e.g.
ReferenceController.CreateBusiness();
MyApplication/Reference/CreateBusiness
?
I have multiple, totally unrelated “reference” entities, would that mean a controller with a very large number of methods in there?
e.g. List, Create, Read, Update, Delete + confirmations?
Can you make controller methods Generic and have Create(T …) ?
I would do something like this:
A Generic Crud Repository like:
Then A generic Crud Controller like
And for specific type of entities, just extend CrudController like:
Edit 1:
If you have really TOOOO many entities, there are ways to eliminate the need of inheriting the
CrudControllerfor each entity. You may want to write your customControllerFactoryfor that.