SCB.DataPipe.EntityFramework 4.2.0

Additional Details

This package has been withdrawn in favour of a reference implementation demonstrating EF integration with DataPipe

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package SCB.DataPipe.EntityFramework --version 4.2.0
                    
NuGet\Install-Package SCB.DataPipe.EntityFramework -Version 4.2.0
                    
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="SCB.DataPipe.EntityFramework" Version="4.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SCB.DataPipe.EntityFramework" Version="4.2.0" />
                    
Directory.Packages.props
<PackageReference Include="SCB.DataPipe.EntityFramework" />
                    
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 SCB.DataPipe.EntityFramework --version 4.2.0
                    
#r "nuget: SCB.DataPipe.EntityFramework, 4.2.0"
                    
#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 SCB.DataPipe.EntityFramework@4.2.0
                    
#: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=SCB.DataPipe.EntityFramework&version=4.2.0
                    
Install as a Cake Addin
#tool nuget:?package=SCB.DataPipe.EntityFramework&version=4.2.0
                    
Install as a Cake Tool

DataPipe.EntityFramework

Entity Framework helpers for DataPipe pipelines

Provides filters to integrate Entity Framework operations into DataPipe pipelines.


Install

dotnet add package SCB.DataPipe.EntityFramework

Filters

OpenDbContext

Opens a scoped DbContext for the duration of child filter execution.

pipe.Add(new OpenDbContext<OrderMessage>(
    msg => new AppDbContext(options),
    new LoadOrder(),
    new SaveOrder()
));

StartEfTransaction

Wraps child filters in a database transaction. Commits when msg.Commit = true.

pipe.Add(new OpenDbContext<OrderMessage>(
    msg => new AppDbContext(options),
    new StartEfTransaction<OrderMessage>(
        new ProcessOrder(),
        new MarkCommit()  // Sets msg.Commit = true
    )
));

Important: Scoped Resource Lifetime

Both OpenDbContext and StartEfTransaction manage resources with strictly scoped lifetimes.

Rules for Child Filters

  1. Do not capture references to msg.DbContext or the transaction for use after the filter's Execute method returns.

  2. Do not use fire-and-forget patterns (e.g., Task.Run without awaiting) that access the DbContext.

  3. Complete all database work within the synchronous-async flow of your filter's Execute method.

❌ Incorrect Usage

public class BadFilter : Filter<OrderMessage>
{
    public async Task Execute(OrderMessage msg)
    {
        // DON'T DO THIS - context will be disposed before this runs
        _ = Task.Run(async () => 
        {
            await msg.DbContext.SaveChangesAsync();  // ObjectDisposedException!
        });
    }
}

✅ Correct Usage

public class GoodFilter : Filter<OrderMessage>
{
    public async Task Execute(OrderMessage msg)
    {
        // All DbContext work completed before returning
        msg.DbContext.Orders.Add(new Order { ... });
        await msg.DbContext.SaveChangesAsync();
    }
}

Key Points

  • Scoped EF DbContext and transaction management
  • Automatic disposal when child filters complete
  • Works seamlessly with DataPipe pipelines
  • Fully async and thread-safe
  • Supports custom isolation levels for transactions
  • Gracefully handles non-relational providers

Documentation

Full documentation: 👉 https://github.com/SteveBate/DataPipe

License

MIT

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