Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

ukad-group/EfRepository

Repository files navigation

EfRepository

Entity Framework Core implementation of the generic repository pattern.

Features

  • Generic IRepository<T> implementation for Entity Framework Core
  • Async/await support with CancellationToken
  • Include and ThenInclude for eager loading
  • No-tracking queries for read-only scenarios
  • Patch operations for partial updates
  • Batch operations (AddRange, Update collections)

Installation

dotnet add package UkadGroup.EfRepository

Or via NuGet Package Manager:

Install-Package UkadGroup.EfRepository

Usage

  1. Have your DbContext implement IEfRepositoryDbContext:
public class AppDbContext : DbContext, IEfRepositoryDbContext
{
    public DbSet<Product> Products { get; set; }
}
  1. Register the repository in your DI container:
services.AddDbContext<AppDbContext>();
services.AddScoped<IEfRepositoryDbContext>(sp => sp.GetRequiredService<AppDbContext>());
services.AddEfRepository();
  1. Inject and use the repository:
public class ProductService
{
    private readonly IRepository<Product> _repository;

    public ProductService(IRepository<Product> repository)
    {
        _repository = repository;
    }

    public async Task<Product> GetByIdAsync(int id)
    {
        return await _repository.GetByIdAsync(id);
    }
}

Requirements

Downloads

NuGet

License

MIT License - see LICENSE for details.

Support and Engineering Services

UKAD provides engineering support for teams that need help with solution design, integration or long term development. If you want to extend this project or need expertise in .NET, React, Azure, AI, Umbraco or Optimizely, you can contact us at hi@ukad-group.com.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages