Title: Creating A Generic Repository in .NET Core w/ Entity Framework Core 2

Clayton Hunt

Clayton Hunt

Target Audience: Some prior knowledge needed

Are you using Entity Framework or some other ORM? Do you have a direct dependency on that ORM? Maybe you've created one or more repositories to abstract away all of the EF stuff. We will explore the Repository pattern and then create our own version of it that is fully compatible with Entity Framework Core 2. While we are at it we will talk about Generics in C#, hopefully demystifying covariance and contravariance. We will then configure the application to use a single implementation Repository<T> to service all of our EF request. Lastly, we will show how using the suggested repository pattern can help when doing TDD (Test Driven Development).

Back