c# - Using MVC + Repository Pattern, where Business Logic should be? -
I want to know the right concept about this if I have an MVC application with a repository pattern, where should be BL?
-
Should it be inside the model? Should the model have all business logic before calling the Uniformwork to insert or not insert data into the database?
-
Should it be in the controller? Before calling the model?
-
Do I need a service level to do business logic and should decide whether I should call the model to call UnitOffer to save data?
A good explanation will be very helpful.
A short answer - It depends if it is a very complex or large size application, then I can use the repository I want to create a service layer project as a dependency. If this is a small application, then I will keep the controller in logic. In my opinion, if it takes more time and effort to create a service level, then this application (either one or two controllers) is made, so I do not understand it to go that way. You have to consider the possibility that the application will increase. It can be very small which can be very small and in that case, again, it can be more beneficial to create a separate service level.
Comments
Post a Comment