Repository Pattern for EF core

Repository Pattern for EF core

Oct 02, 2021

My new repository is online!!!!
Generic repository patter for EF core, is a project written in C# for create simply Reporitory for each entity in our ContextDB.

https://github.com/DenMic/EF-Repository-Pattern

public async Task Get()
{
     // Create your Repository of Type Customer
     var repCustomer = repositoryManager.GenerateModelRepository<Customer>();

     // Get First Customer where City == "New York"
     var b = await repCustomer.GetFirstModelAsync(x => x.City == "New York");

     // Get List of Customers where FirstName == Liam orderedBy City and include Orders
     var c = await repCustomer.GetListModelsAsync(
            x => x.FirstName == "Liam",
            x => x.OrderBy(y => y.City),
            x => x.Include(y => y.Orders)
     );

     // Get AllList of Customers Order by City and FirstName
     var d = await repCustomer.GetListModelsAsync(
         orderByFunc: x => x.OrderBy(y => y.City).ThenBy(y => y.FirstName)
     );
}

Enjoy this post?

Buy DenMic a beer

More from DenMic