Of course business logic should be inside domain models. But, domain models are more than just entity framework entities. Domain models consists of many small classes which reflects business domain.
In my typical MVC application, I usually split some type of business logic into these (but not limited to):
- ViewModels which responsible for model for view.
- Controllers which is thin and responsible for application flow.
- Simple business logic such as required field can exist as attribute within entity framework model or ViewModels.
- Complex business logic such as place order, booking ticket are promoted to be its own class such as PlaceOrderOperation or PlaceOrderCommand.
- Simple query logic might be inside the Controller or short extension method to
DbSet<Entity>
type.
- Complex Query also promoted to its own class such as GetMostPorpularProductsQuery assuming that the query is complex.
- Infrastructure components may be extension to Entity Framework or MVC components such as ActionFilter, CustomRoute, CustomTemplate or its own classes such as EncyptionHelpers etc.
Conclusion
Building domain Model is more than just creating classes prefix with BusinessLogic such as UserBusinessLogic or with Services such as UserServices. It should consists of many small classes which responsible for one thing. Of course, you would require some usage of design patterns, choice of frameworks, infrastructure components such as error handling, localization, caching, etc.
Welcome to the trade-off world. :)