0
exlnt created
These questions are just to seek guidance on best practice for the items below. I have the read the docs and still a bit confused as to the best location for such things.
In multiple app services I have code that is repeated for a "shared" entity. Naturally trying to follow the DRY principle I would like to consolidate this code to a single location.
- Questions
- Can I move such code into the base application service class (MyAppAppServiceBase)?
- The code that is repeated is using a repository for an entity and making inserts into a table. So naturally I'm injecting the repository into the app service through the constructor, can I do this in the base class?
In multiple MVC controllers I have code that is repeated for a "shared" entity. Naturally trying to follow the DRY principle I would like to consolidate this code to a single location.
- Question
- Can I move such code into the base MVC controller class (MyAppControllerBase)?
1 Answer(s)
-
0
- Can I move such code into the base application service class (MyAppAppServiceBase)?
Yes.
- The code that is repeated is using a repository for an entity and making inserts into a table. So naturally I'm injecting the repository into the app service through the constructor, can I do this in the base class?
Yes.
- Can I move such code into the base MVC controller class (MyAppControllerBase)?
Yes.