Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Understanding and Implementing Repository and Unit of Work Pattern in ASP.NET MVC Application

, 12 Apr 2013
In this article we will try to see what is Repository and Unit of Work Pattern in an ASP.NET MVC application.
RepoUowSample-noexe.zip
RepoUowSample
RepoUowSample
App_Data
SampleDatabase.mdf
SampleDatabase_log.LDF
Controllers
Global.asax
Models
SampleDbModel.edmx
Properties
RepoUowSample.csproj.user
Views
BookEn
Books
Home
RepoUowSample.suo
RepoUowSample.zip
SampleDatabase.mdf
SampleDatabase_log.LDF
bin
Content
Global.asax
SampleDbModel.edmx
obj
Debug
DesignTimeResolveAssemblyReferences.cache
DesignTimeResolveAssemblyReferencesInput.cache
edmxResourcesToEmbed
Models
TempPE
Models.SampleDbModel.Designer.cs.dll
RepoUowSample.csproj.user
Scripts
RepoUowSample.suo
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RepoUowSample.Models
{
    // This interface will give define a contract for CRUD operations on
    // Books entity
    public interface IBooksRepository
    {
        List<Book> GetAllBooks();
        Book GetBookById(int id);
        void AddBook(Book book);
        void UpdateBook(int id, Book book);
        void DeleteBook(Book book);
        void Save();
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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

About the Author

Rahul Rajat Singh
Software Developer (Senior)
India India
I Started my Programming career with C++. Later got a chance to develop Windows Form applications using C#. Currently using C#, ASP.NET & ASP.NET MVC to create Information Systems, e-commerce/e-governance Portals and Data driven websites.

My interests involves Programming, Website development and Learning/Teaching subjects related to Computer Science/Information Systems. IMO, C# is the best programming language and I love working with C# and other Microsoft Technologies.
  • Microsoft Certified Technology Specialist (MCTS): Web Applications Development with Microsoft .NET Framework 4
  • Microsoft Certified Technology Specialist (MCTS): Windows Communication Foundation Development with Microsoft .NET Framework 4
 
If you like my articles, please visit my website for more: www.rahulrajatsingh.com[^]
Follow on   Twitter   Google+   LinkedIn

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 12 Apr 2013
Article Copyright 2013 by Rahul Rajat Singh
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid