Ploch.Data.GenericRepository.EFCore 4.0.1

dotnet add package Ploch.Data.GenericRepository.EFCore --version 4.0.1
                    
NuGet\Install-Package Ploch.Data.GenericRepository.EFCore -Version 4.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ploch.Data.GenericRepository.EFCore" Version="4.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ploch.Data.GenericRepository.EFCore" Version="4.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Ploch.Data.GenericRepository.EFCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ploch.Data.GenericRepository.EFCore --version 4.0.1
                    
#r "nuget: Ploch.Data.GenericRepository.EFCore, 4.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Ploch.Data.GenericRepository.EFCore@4.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ploch.Data.GenericRepository.EFCore&version=4.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Ploch.Data.GenericRepository.EFCore&version=4.0.1
                    
Install as a Cake Tool

Ploch.Data.GenericRepository.EFCore

Entity Framework Core implementations of the Generic Repository and Unit of Work patterns defined in Ploch.Data.GenericRepository.

Key Features

  • Full repository implementations -- ReadRepositoryAsync<TEntity, TId>, ReadWriteRepositoryAsync<TEntity, TId>, QueryableRepository<TEntity>
  • Unit of Work -- UnitOfWork<TDbContext> with CommitAsync and RollbackAsync
  • DI registration -- AddRepositories<TDbContext>() registers all interfaces with a single call
  • Custom repository support -- AddCustomReadWriteAsyncRepository for domain-specific repositories
  • Audit entity handler -- AuditEntityHandler for automatic timestamp and user tracking
  • Eager loading -- onDbSet parameter for Include/ThenInclude on read operations

Installation

<PackageReference Include="Ploch.Data.GenericRepository.EFCore" />

Quick Start

For most applications, use one of the provider-specific packages instead of this package directly:

  • Ploch.Data.GenericRepository.EFCore.SqLite -- SQLite
  • Ploch.Data.GenericRepository.EFCore.SqlServer -- SQL Server
// Recommended: use a provider-specific package for one-call registration
using Ploch.Data.GenericRepository.EFCore.DependencyInjection;
builder.Services.AddDbContextWithRepositories<MyDbContext>();

// Alternative: manual registration with this package
services.AddDbContext<MyDbContext>(options => options.UseSqlite(connectionString));
services.AddRepositories<MyDbContext>();
// Use repositories
public class MyService(IReadWriteRepositoryAsync<Product, int> repo)
{
    public async Task CreateAsync(Product product)
    {
        await repo.AddAsync(product);
    }

    public async Task<Product?> GetWithDetailsAsync(int id)
    {
        return await repo.GetByIdAsync(id,
            onDbSet: q => q.Include(p => p.Category).Include(p => p.Tags));
    }
}

Documentation

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Ploch.Data.GenericRepository.EFCore:

Package Downloads
Ploch.Data.GenericRepository.EFCore.IntegrationTesting

Generic Repository, Unit of Work and Data Utilities

Ploch.Data.GenericRepository.EFCore.SqlServer

Generic Repository, Unit of Work and Data Utilities

Ploch.Data.GenericRepository.EFCore.SqLite

Generic Repository, Unit of Work and Data Utilities

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.1 92 9/10/2026
2.1.0 256 11/3/2024