.NET Framework: Generic Repository Pattern in ASP.NET MVC
This article will guide you through creating a small application using generic repository pattern in MVC framework. This article is basically targeted for beginner to intermediate level programmer so that they could at least understand how to develop ASP.NET MVC app. After reading this article you will be in position to understand the followings:
- Basic concept of performing select, insert, update, and delete operation with the use of MVC repository
- How to open bootstrap model popup window and pass value to the model popup using jQuery
- Upload the images in desired storage location from the model window and display images in the model window with the help of jQuery ajax call and generic handler
For the practical application, I am creating a simple application of Employee repository which contains basic employee information along with their documents. All documents will be stored in a folder, storage location of which is specified in the appsetting of web.config file. Following screenshot shows how the employee image upload and display window looks like:
Moreover, you could find similar articles written in similar topics around CodeProject and other tutorial sites. I would request you to refer following tutorials which are written by some expert programmers for your further reference:
- Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application
- Generic Repository and UnitofWork patterns in MVC – By Ashish Shukla
- CRUD Operations Using the Repository Pattern in MVC – By Sandeep Singh Shekhawat
Now, I would like to shortly discuss about what this article makes difference from the list of articles those I mentioned above. Article links 1 and 3 that I mentioned above contains detail explanation and purely dedicated to explain Repository Pattern and Unit of Work Pattern. Article 2 is short and straight but incomplete. Although the article that I am writing does not include more theoretical explanations but it introduces the subject matter shortly and aims to provide details implementation so that anyone with little knowledge on MVC could understand the concept and start working immediately. It also summarizes all independent features discussed in above all articles in this single one. Moreover, it provides additional technique about opening model popup, and uploading and displaying images which is not available on any articles that I enlisted above…….
Credit: Sharad Chandra Pyakurel