I'm looking for a bit of experience and explanation here, given that different sources give different recommendations. I am totally new to MVC. I know this question has been asked before, but I am not (currently) using EF or Linq.

I have a SQL database with many stored procedures. Previously when used with webforms, there was a business layer that contained helper methods for calling the procedures and returning DataSets to the pages. The important part is that the procedures often interrogated about 20 tables; the pages do not simply reflect the database structure exactly (as I see in the majority of MVC tutorials):

SQL database <--> stored procedures <--> business layer <--> web forms

I want to take the best approach here to start on the right footing and learn properly but appreciate there may not be a correct answer. Therefore if you post, could you please offer some explanation as to "why"?

  • Should stored procedure logic (SQLCommand/business methods etc) go within Model or Controller?

One post advises neither, but retain the business layer. Another expert advises that

[Models/Entities] should not have any addon methods outside of what's coming back from the database

  • If the business layer is retained, where are the methods called from (e.g. Model or Controller)?

  • If the above answer is "Neither", does that mean the Model part will go unused?

That almost feels that things aren't being done properly, however in this tutorial that appears to be what happens.

  • Should I plug in the Entity Framework into the Model layer to call the business layer?

That feels like overkill, adding all that additional logic.

Related posts

Recent Viewed