Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.
/ GenericEFRepo Public archive

Implementation of a Generic Entity Framework 6 Repository

License

Notifications You must be signed in to change notification settings

Resgrid/GenericEFRepo

Repository files navigation

Resgrid Generic EF Repo Example

An example of Generic Entity Framework 6 Code First Repository, utilizing of the repo in a services/business logic class and testing framework examples using BDD style tests. The repoistory supports sync and async calls. One test mocking the repo and another utilizing SqlServerCe for integration testing. This solution example is also utilizing Ninject for DI, NUnit for testing, Moq for mocking.

This is a fully functional generic entity framework repository used by Resgrid (http://resgrid.com) running on Microsoft's Azure utilizing a SQL Azure backend, 2 load balanced web servers, 2 load balanced API servers and 2 workers.


About Resgrid

Resgrid is a software as a service (SaaS) logistics, management and communications platform for first responders, volunteer fire departments, career fire, EMS, public safety, HAZMAT, CERT, disaster response, etc.


Solution

  • Resgrid.Model
    • Contains Model/POCO Objects
    • Interfaces for Service Layer & Repo
  • Resgrid.Repository
    • EF Code Configurations
      • 1 for Standard Operation
      • 1 for Testing (Utilizing auto-create db)
    • Context
    • Migrations
    • RepositoryBase (where all the magic happens)
    • GenericRepository Injectable implementation of RepositoryBase
  • Resgrid.Services
    • Example Utilization of the generic repo
  • Resgrid.Tests
    • Example of how a generic repo can be mocked
    • Example of how EF can be used to create data intergration tests

Notes

When we were looking around for some good example of wrapping Entity Framework inside a repository pattern there were tons of one off examples or examples buried in extremely large projects. Our goal here to show a clean and simple of a generic entity framework repository. Inside the Resgrid.Repository project you can open up the RepositoryBase file to see the meat and potatoes of the generic repo.

Shawn Jackson (@DesignLimbo\designlimbo.com) Jason Jarrett (@staxmanade\staxmanade.com)


License

Apache 2.0

About

Implementation of a Generic Entity Framework 6 Repository

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages