Skip to content
| Marketplace
Sign in
Visual Studio>Templates>Repository and Unit of Work
Repository and Unit of Work

Repository and Unit of Work

joelnet

|
6,885 installs
| (6) | Free
Generates Repositories and a Unit of Work for your ADO.NET Entity Data Models.
Download

This template auto-generates Repositories and a Unit of Work for your ADO.NET Entity Data Model, allowing you to Mock and Unit Test Entity Framework.

After installing the template, Navigate to the folder your EDMX file is located and select Add New Item.  You will find the Repository and Unit of Work template in the Data section.

 

 

The only change you have to make is pointing the T4 template to your EDMX file.  Hit save and you're done.

 

Example Code:

Updates in v1.2.1

  • Save method marked as virtual.
  • Constructor overloads created for MemoryRepository.
  • Minor refactoring.

Updates in v1.2.0

  • Added the [ExcludeFromCodeCoverage] attribute so it doesn't mess with your code coverage statistics.
  • Made methods virtual to help with mocking.
  • Made classes partials to help with extensibility.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft