I'm new to ASP.NET MVC development and I have a question regarding Business Logic. Specifically, where should the Business Logic live in my application.
Just to give you a bit more information about my current MVC application structure, I've decided to go with a Unit of Work Design Pattern and the Repository Design Pattern for my Data Access Layer. This was chosen to allow flexibility as the data source may be changing and we want to make the application decoupled from it's original data source.
Here's a business logic scenario I have and I'm questioning where it should live.
I need to gather information from 3 individual tables in my database, perform some calculation on that data (and in some cases merge some data) and return the matching row(s) to my Controller so that can be displayed in my View.
In my search to discover where to put this logic I was pointed in several different directions. For example:
- Your business logic should be placed in the Model, and you should be aiming for fat models.
- Most of your logic goes in the MVC controller
- Controller shouldn't have any logic and should be "thin"
- You should create a "Service Layer" and put your Business Logic there.
I'm lost. Help.