CSharpEssentials.EntityFrameworkCore
3.0.3
dotnet add package CSharpEssentials.EntityFrameworkCore --version 3.0.3
NuGet\Install-Package CSharpEssentials.EntityFrameworkCore -Version 3.0.3
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="CSharpEssentials.EntityFrameworkCore" Version="3.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CSharpEssentials.EntityFrameworkCore" Version="3.0.3" />
<PackageReference Include="CSharpEssentials.EntityFrameworkCore" />
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 CSharpEssentials.EntityFrameworkCore --version 3.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CSharpEssentials.EntityFrameworkCore, 3.0.3"
#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 CSharpEssentials.EntityFrameworkCore@3.0.3
#: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=CSharpEssentials.EntityFrameworkCore&version=3.0.3
#tool nuget:?package=CSharpEssentials.EntityFrameworkCore&version=3.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CSharpEssentials.EntityFrameworkCore
Extensions, interceptors, and utilities for Entity Framework Core. Audit trails, domain events, pagination, and CQRS support.
Features
- Audit Interceptor — Auto-populates
CreatedAt,CreatedBy,UpdatedAt,UpdatedByand handles soft deletes. - Domain Event Interceptor — Dispatches domain events with before/after save timing and outbox support.
- Slow Query Logging — Logs queries exceeding a configurable threshold.
- Pagination — Offset-based and cursor-based pagination on
IQueryable. - CQRS Support — Register separate write and read DbContexts.
- SQL Connection Factories — Abstractions for raw SQL/Dapper scenarios.
Installation
dotnet add package CSharpEssentials.EntityFrameworkCore
Usage
Audit Interceptor
services.AddAuditInterceptor(() => "system-user");
services.AddDbContext<MyDbContext>((sp, options) =>
options.UseNpgsql(connectionString)
.AddInterceptors(sp.GetRequiredService<AuditInterceptor>()));
Domain Event Interceptor
services.AddSingleton<IDomainEventPublisher, MyPublisher>();
services.AddSingleton<DomainEventInterceptor>();
// In your entity
public void UpdatePrice(decimal newPrice)
{
Price = newPrice;
Raise(new PriceChangedEvent(Id, newPrice));
}
Pagination
using CSharpEssentials.EntityFrameworkCore.Pagination;
// Offset-based
var response = await dbContext.Users.PaginateAsync(
new PaginationRequest { PageNumber = 1, PageSize = 10 }, ct);
// Cursor-based
var cursorResponse = await dbContext.Logs.PaginateAsync(
new CursorPaginationRequest<DateTimeOffset> { Limit = 20, Cursor = lastDate },
cursorSelector: x => x.CreatedAt);
CQRS Write/Read
services.AddCqrsDbContexts<WriteDbContext, ReadDbContext>(
configureWrite: (sp, options) => options.UseNpgsql(connectionString),
configureRead: (sp, options) => options.UseNpgsql(connectionString).UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking));
Slow Query Logging
services.AddSlowQueryInterceptor(TimeSpan.FromMilliseconds(500));
| Product | Versions 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 is compatible. 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.
-
net10.0
- CSharpEssentials.Core (>= 3.0.3)
- CSharpEssentials.Entity (>= 3.0.3)
- CSharpEssentials.Enums (>= 3.0.3)
- CSharpEssentials.Json (>= 3.0.3)
- CSharpEssentials.Maybe (>= 3.0.3)
- CSharpEssentials.Results (>= 3.0.3)
- EFCore.NamingConventions (>= 9.0.0)
- Microsoft.EntityFrameworkCore (>= 9.0.4)
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Caching.Memory (>= 9.0.4)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.4)
-
net8.0
- CSharpEssentials.Core (>= 3.0.3)
- CSharpEssentials.Entity (>= 3.0.3)
- CSharpEssentials.Enums (>= 3.0.3)
- CSharpEssentials.Json (>= 3.0.3)
- CSharpEssentials.Maybe (>= 3.0.3)
- CSharpEssentials.Results (>= 3.0.3)
- EFCore.NamingConventions (>= 8.0.0)
- Microsoft.Bcl.TimeProvider (>= 8.0.0)
- Microsoft.EntityFrameworkCore (>= 8.0.0)
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Caching.Memory (>= 9.0.4)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.4)
- System.Text.Json (>= 9.0.0)
-
net9.0
- CSharpEssentials.Core (>= 3.0.3)
- CSharpEssentials.Entity (>= 3.0.3)
- CSharpEssentials.Enums (>= 3.0.3)
- CSharpEssentials.Json (>= 3.0.3)
- CSharpEssentials.Maybe (>= 3.0.3)
- CSharpEssentials.Results (>= 3.0.3)
- EFCore.NamingConventions (>= 9.0.0)
- Microsoft.EntityFrameworkCore (>= 9.0.4)
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Caching.Memory (>= 9.0.4)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.3 | 0 | 5/5/2026 |
| 3.0.2 | 13 | 5/5/2026 |
| 3.0.1 | 39 | 5/3/2026 |
| 3.0.0 | 38 | 5/3/2026 |
| 2.1.0 | 222 | 11/26/2025 |
| 2.0.9 | 218 | 9/30/2025 |
| 2.0.8 | 205 | 9/29/2025 |
| 2.0.7 | 205 | 9/29/2025 |
| 2.0.6 | 209 | 9/29/2025 |
| 2.0.5 | 208 | 9/29/2025 |
| 2.0.4 | 199 | 9/28/2025 |
| 2.0.3 | 202 | 9/28/2025 |
| 2.0.2 | 208 | 9/28/2025 |
| 2.0.1 | 199 | 9/28/2025 |
| 2.0.0 | 221 | 9/28/2025 |
| 1.0.16 | 489 | 2/4/2025 |
| 1.0.15 | 385 | 1/29/2025 |
| 1.0.14 | 184 | 12/27/2024 |
| 1.0.13 | 222 | 12/18/2024 |
| 1.0.12 | 213 | 12/18/2024 |
Loading failed