Polecat.EntityFrameworkCore 5.19.2

dotnet add package Polecat.EntityFrameworkCore --version 5.19.2
                    
NuGet\Install-Package Polecat.EntityFrameworkCore -Version 5.19.2
                    
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="Polecat.EntityFrameworkCore" Version="5.19.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Polecat.EntityFrameworkCore" Version="5.19.2" />
                    
Directory.Packages.props
<PackageReference Include="Polecat.EntityFrameworkCore" />
                    
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 Polecat.EntityFrameworkCore --version 5.19.2
                    
#r "nuget: Polecat.EntityFrameworkCore, 5.19.2"
                    
#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 Polecat.EntityFrameworkCore@5.19.2
                    
#: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=Polecat.EntityFrameworkCore&version=5.19.2
                    
Install as a Cake Addin
#tool nuget:?package=Polecat.EntityFrameworkCore&version=5.19.2
                    
Install as a Cake Tool

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 stream
  • EfCoreMultiStreamProjection<TDoc, TId, TDbContext> — aggregate across streams via Identity / Identities
  • EfCoreEventProjection<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
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed