Click here to Skip to main content
15,607,737 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI friends,

I am new with MVC 3,mean while implementing the repository pattern,
I found that the repository pattern make the abstraction layer between the view and the bussiness logic layer,

But my quesction here is,Is it mandatory to implement the repository pattern,If yes then why.

Are any other patterns avalible to make abstraction layer.

Please suggest me the actual use of repository pattern.


1 solution

No. Repository pattern is not mandatory.

But it is really useful in complex projects and/or if you want to use unit testing. Read this article:[^]

But it is not between the view and the BL, it is between the data model and the controller. And it is not only (not really?) an abstraction layer, it is a way to separate the logic from the data, so you can change the data source easily - for example in a mocking scenario.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900