How to implement the Repository Pattern in an











- Slides: 11
How to implement the Repository Pattern in an ASP. NET MVC Application Dhananjay Kumar Developer Evangelist – Infragistics Microsoft MVP http: //debugmode. net
Some Information ØWebinar recording will be available on http: //www. infragistics. com/community/blogs/dhananjay_kumar/def ault. aspx ØVisit http: //www. infragistics. com/ for all the products details. ØTweet us @infragistics for your experience ØPlease reach out to us at Sales-India@infragistics. com for any follow up questions you may have. We welcome the opportunity to assist you.
Share your experience by tweeting and Facebook with hashtag #Infragistics or mention to @infragistics
Host : Dhananjay Kumar ØDeveloper Evangelist – Infragistics Ø 6 times Microsoft MVP Ø@debug_mode ØBlog : http: //debugmode. net ØEmail : Dkumar@infragistics. com
Agenda • What is Repository Pattern • Advantages of Repository Pattern • Step by Step implementing Repository pattern • Creating Core Project • Creating Infrastructure Project • Creating Test Project • Creating MVC Project
Advantage of Repository Pattern üBusiness logic can be unit tested without data access logic üDatabase access code can be reused üDatabase access code is centrally managed so easy to implement any database access policies such that caching üEasy to implement domain logics üDomain entities or business entities are strongly typed with the annotations
Some of the difficulties üDuplicate code ü Difficulty implementing any data related logic or policies such that caching üDifficulty in unit testing the business logic without having the data access layer ü Tightly coupled business logic and database access logic
Project Structure
Project Structure Project Responsibility Type Core Project Domain entities and interface for database operations Libraries to perform database operations. Such as Entity Framework library. Unit Tests for Infrastructure projects MVC based web application using Infrastructure and Core projects libraries using Dependency Injection Class library Infrastructure Project Test Project MVC Project Class library Unit Test MVC
Let us write Code step by step to implement Repository Pattern
What Infragistics can offer you? • We welcome all of you to take advantage of a FREE 30 Day Trial by downloading the product at: http: //www. infragistics. com/products/ultimate/download • Please reach out to us at Sales-India@infragistics. com for any follow up questions you may have. We welcome the opportunity to assist you.