Repository pattern is used to create an abstraction layer between data access layer and business logic layer. This abstraction layer contains the data manipulation methods which are communicating data access layer to serve data as per business requirement to logical layer. The main purpose is to create this layer for isolating data access layer so that any changes cannot affect business logic layer directly. For example, a POS application is usually deployed to different stores. Few new clients want to use Microsoft SQL Server database system and others want Oracle or any other database. Also they have few different relationship database systems to store their data but business logic is almost the same. Then this Repository pattern will help the developers to detach the layer and add new data access layer. Unit of work is a pattern to handle the transaction during data manipulation using repository pattern. So we can say according to Martin Fowler, Maintains a list of objects affected by a business transaction and coordinates the writing out of changes and the resolution of concurrency problem. Implementing these patterns can help insulate the application from changes in the data store and also gives advantages to automate unit testing. Though, these patterns are widely used for DDD but it facilitate for TDD also.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to


C#,.NET,Architect,Intermediate,VS2010,.Net,Articles,Computer Tutorials, MVC, MVC4,ASP.Net,Repository Pattern,Unit Of Work,Entity Framework