Polecat.EntityFrameworkCore
5.19.2
dotnet add package Polecat.EntityFrameworkCore --version 5.19.2
NuGet\Install-Package Polecat.EntityFrameworkCore -Version 5.19.2
<PackageReference Include="Polecat.EntityFrameworkCore" Version="5.19.2" />
<PackageVersion Include="Polecat.EntityFrameworkCore" Version="5.19.2" />
<PackageReference Include="Polecat.EntityFrameworkCore" />
paket add Polecat.EntityFrameworkCore --version 5.19.2
#r "nuget: Polecat.EntityFrameworkCore, 5.19.2"
#:package Polecat.EntityFrameworkCore@5.19.2
#addin nuget:?package=Polecat.EntityFrameworkCore&version=5.19.2
#tool nuget:?package=Polecat.EntityFrameworkCore&version=5.19.2
Polecat.EntityFrameworkCore
Entity Framework Core integration for Polecat projections.
Project your event streams into EF Core entities instead of Polecat documents, and have both written
in the same transaction. Useful when a read model already belongs to an existing DbContext, or when
you want EF Core's mapping and migrations over a projected table.
Install
dotnet add package Polecat.EntityFrameworkCore
Projection base classes
Derive from the base that matches your projection shape and override ApplyEvent:
public class OrderProjection : EfCoreSingleStreamProjection<Order, MyDbContext>
{
public OrderProjection() => IncludeType<OrderPlaced>();
protected override Order? ApplyEvent(Order? snapshot, Guid identity, IEvent @event,
MyDbContext dbContext, IQuerySession session)
=> @event.Data switch
{
OrderPlaced placed => new Order { Id = placed.OrderId, Customer = placed.CustomerName },
_ => snapshot
};
}
Register it against the store, choosing a lifecycle:
opts.Projections.Add<OrderProjection, Order, MyDbContext>(
opts, new OrderProjection(), ProjectionLifecycle.Async);
Three shapes are available:
EfCoreSingleStreamProjection<TDoc, TDbContext>— one aggregate per streamEfCoreMultiStreamProjection<TDoc, TId, TDbContext>— aggregate across streams viaIdentity/IdentitiesEfCoreEventProjection<TDbContext>— free-form per-event side effects, into EF Core and Polecat alike
Transactions
The DbContext enlists in the Polecat session's unit of work, so SaveChangesAsync flushes the
event append and the EF Core changes together — there is no window where one landed and the other
did not.
Requirements
- .NET 9 or .NET 10
- A configured Polecat
IDocumentStore— see the Polecat package
Links
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- Microsoft.EntityFrameworkCore.SqlServer (>= 10.0.0)
- Polecat (>= 5.19.2)
- Weasel.EntityFrameworkCore (>= 9.24.0)
-
net9.0
- Microsoft.EntityFrameworkCore.SqlServer (>= 9.0.14)
- Polecat (>= 5.19.2)
- Weasel.EntityFrameworkCore (>= 9.24.0)
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 |
|---|---|---|
| 5.19.2 | 38 | 8/21/2026 |
| 5.19.1 | 34 | 8/20/2026 |
| 5.19.0 | 77 | 8/18/2026 |
| 5.18.0 | 87 | 8/18/2026 |
| 5.17.0 | 84 | 8/17/2026 |
| 5.16.0 | 101 | 8/16/2026 |
| 5.15.1 | 80 | 8/15/2026 |
| 5.15.0 | 80 | 8/15/2026 |
| 5.14.0 | 88 | 8/15/2026 |
| 5.13.0 | 79 | 8/14/2026 |
| 5.12.0 | 92 | 8/11/2026 |
| 5.11.0 | 100 | 8/8/2026 |
| 5.10.0 | 95 | 8/3/2026 |
| 5.9.1 | 108 | 7/31/2026 |
| 5.9.0 | 107 | 7/30/2026 |
| 5.8.0 | 98 | 7/30/2026 |
| 5.7.1 | 97 | 7/28/2026 |
| 5.7.0 | 96 | 7/26/2026 |
| 5.6.0 | 103 | 7/24/2026 |
| 5.5.0 | 100 | 7/22/2026 |