Sunday, April 8, 2018

DB first MVC app - where do I put my business logic?

I've read many posts and there are conflicting statements. Main one is "business logic in the model". But then people start talking about how "business logic is better divided into domain and application logic" etc. etc.

But my model is only the entity data model. From my understanding, controller is the medium level, similar to business logic layer of 3 layered applications, and should make sure that it "gets" the correct data from the model, manipulates it - e.g. puts it through an algorithm and shows it to view. E.g. on Web app user says "show me only X events, from Y to Z date". And the controller gets the request, asks the context (WhateverDBEntities) for data, filters it according to demand and returns it into view.

But people say "fat models, skinny controllers" and MVC is only apparently a presentation structure and I should have additional subprojects apart from my MVC part - I am getting only more confused.

DB first MVC app - where do I put my business logic? Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team