SCB.DataPipe.EntityFramework
4.2.0
This package has been withdrawn in favour of a reference implementation demonstrating EF integration with DataPipe
dotnet add package SCB.DataPipe.EntityFramework --version 4.2.0
NuGet\Install-Package SCB.DataPipe.EntityFramework -Version 4.2.0
<PackageReference Include="SCB.DataPipe.EntityFramework" Version="4.2.0" />
<PackageVersion Include="SCB.DataPipe.EntityFramework" Version="4.2.0" />
<PackageReference Include="SCB.DataPipe.EntityFramework" />
paket add SCB.DataPipe.EntityFramework --version 4.2.0
#r "nuget: SCB.DataPipe.EntityFramework, 4.2.0"
#:package SCB.DataPipe.EntityFramework@4.2.0
#addin nuget:?package=SCB.DataPipe.EntityFramework&version=4.2.0
#tool nuget:?package=SCB.DataPipe.EntityFramework&version=4.2.0
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
Do not capture references to
msg.DbContextor the transaction for use after the filter'sExecutemethod returns.Do not use fire-and-forget patterns (e.g.,
Task.Runwithout awaiting) that access theDbContext.Complete all database work within the synchronous-async flow of your filter's
Executemethod.
❌ 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 | 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. |
-
net10.0
- Microsoft.EntityFrameworkCore (>= 10.0.1)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.1)
- SCB.DataPipe (>= 4.2.0)
-
net8.0
- Microsoft.EntityFrameworkCore (>= 8.0.22)
- Microsoft.EntityFrameworkCore.Relational (>= 8.0.22)
- SCB.DataPipe (>= 4.2.0)
-
net9.0
- Microsoft.EntityFrameworkCore (>= 9.0.11)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.11)
- SCB.DataPipe (>= 4.2.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 |
|---|