I need my controllers to have several functionalities, e.g.,
- Some of the controllers save my entities to a database, so I use the Repository pattern here (passing the Repository in the constructor).
- Some of the controllers, on the other hand, do this PLUS sending my entities to an external service. In this case I pass the service client in the constructor of the Controller too.
Since my controller cannot inherit from two classes, e.g.,
- DbEntityController: The one that deals with a database repository.
- ServiceEntityController: The one that deals with a remote service client.
Can you give me a couple of advises about how to implement a sort of composition pattern for MVC Controllers? I am actually concerned about the URL routing etc. Is this going to work if my action methods delegate their tasks to an "inner" controller.
Any ideas will help a lot!
Aucun commentaire:
Enregistrer un commentaire