What is the best strategy for calling Stored procedure in MVC?
I am using repository pattern in ASP.NET MVC3. I am extracting data through a stored procedure.
Should I create a different repository for each stored p开发者_Python百科rocedure or just create a single REPOSITORY class for all the procedures?
I can't embed them in Table classes as few of them gets data from two or more tables.
So what can be best option as per the Good repository pattern?
Repositories should handle a model and it's aggregates. It doesn't matter of you use plain SQL or a SP to fetch those.
In other words: The method used to fetch objects are not important. It can be SQL statements, stored procedures, web services or whatever.
What's important is that you group objects the belong together and put them in the same repository class. The classical example is Order
and OrderLine
.
精彩评论