SmartPipe.Extensions.EntityFrameworkCore 2.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SmartPipe.Extensions.EntityFrameworkCore --version 2.2.0
                    
NuGet\Install-Package SmartPipe.Extensions.EntityFrameworkCore -Version 2.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="SmartPipe.Extensions.EntityFrameworkCore" Version="2.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SmartPipe.Extensions.EntityFrameworkCore" Version="2.2.0" />
                    
Directory.Packages.props
<PackageReference Include="SmartPipe.Extensions.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 SmartPipe.Extensions.EntityFrameworkCore --version 2.2.0
                    
#r "nuget: SmartPipe.Extensions.EntityFrameworkCore, 2.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 SmartPipe.Extensions.EntityFrameworkCore@2.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=SmartPipe.Extensions.EntityFrameworkCore&version=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=SmartPipe.Extensions.EntityFrameworkCore&version=2.2.0
                    
Install as a Cake Tool

SmartPipe.Extensions.EntityFrameworkCore

Provider-neutral Entity Framework Core query sources for SmartPipe.Core.

Installation

dotnet package add SmartPipe.Extensions.EntityFrameworkCore

What this package owns

  • EfCorePipelineComponents.QuerySource<TContext,TResult> — a queryable source over either a borrowed IDbContextFactory<TContext> or a caller-supplied async context factory Func<PipelineActivationContext,CancellationToken,ValueTask<TContext>>.
  • EfCorePipelineComponents.CompiledQuerySource<TContext,TResult> — a source over a caller-provided compiled or asynchronous sequence with the same two context-acquisition forms.
  • EfCorePipelineDefinitionBuilder.FromQuery<TContext,TResult> and FromCompiledQuery<TContext,TResult> — typed entry points that return the ordinary Core PipelineDefinitionBuilder<TResult>; stage attachment stays on the normal Transform chain.

The package depends on Microsoft.EntityFrameworkCore and Microsoft.Extensions.Logging.Abstractions only. It never references a provider (SqlServer, Npgsql, Sqlite, InMemory), SmartPipe.Extensions, Dapper, HTTP, JSON, Mapster, Polly, Hosting, or dependency injection. It exposes no write sink, SaveChanges, repository, unit-of-work, ambient transaction, or provider-specific abstraction.

Query behaviour

Concern Contract
Tracking EfCoreQueryOptions.TrackingMode applies AsNoTracking (default), AsNoTrackingWithIdentityResolution, AsTracking, or no operator at all (PreserveQuery) to the caller-created IQueryable<TResult>. The queryable path keeps where TResult : class, which the tracking operators require.
Compiled path CompiledQuerySource has no tracking option because the delegate already fixes the query shape, and its result type is intentionally unconstrained so scalar and struct results work.
Composition Creating a component or definition invokes neither the context factory nor the query factory and performs no I/O. Options are validated and snapshotted at composition.
Context ownership The factory and logger factory are borrowed. CreateDbContextAsync is called once per run; that context belongs to the run and is released exactly once. Concurrent runs never share a context. A factory that returns an already-active shared context is a caller-contract violation that this package does not detect.
Enumeration One logical enumeration per run. The caller's query factory runs once at activation and the compiled delegate runs once per run. Early break and cancellation release the enumerator first and then the context. A second enumeration or any use after disposal fails deterministically.
Failures Context creation, query factory, enumeration, and mapping failures stay primary; cleanup runs exactly once with CancellationToken.None and can never replace a primary failure. Provider exceptions are preserved and no timeout or retry loop is hidden here.
Logging Operation name, result type, pipeline key, run id, item count, duration, and outcome only. Query text, parameter values, connection strings, and payloads are never logged.

Provider buffering (for example a provider that materializes a result set) remains provider behaviour; this package never forces buffering with ToListAsync.

Trimming and NativeAOT

The package makes no blanket trimming or NativeAOT claim. Query shape, provider choice, compiled models, and generated query delegates are evaluated by the consumer. Any reflection or dynamic-code path that appears later must be annotated and documented rather than suppressed globally.

The forwarded legacy EfCoreSelector<T> resolves its entity set through DbContext.Set<T>(), which is trimming-unsafe. Its narrow internal suppression documents exactly that boundary, and the factory-based sources above are the supported alternative for trimmed or NativeAOT consumers.

Usage

var definition = EfCorePipelineDefinitionBuilder
    .FromQuery<AppDbContext, Order>(
        new PipelineKey("orders"),
        contextFactory,                       // IDbContextFactory<AppDbContext> or an async factory
        static (context, activation) => context.Orders.Where(order => order.Total > 0),
        new EfCoreQueryOptions { OperationName = "orders" })
    .Build();

await using var run = await definition.StartAsync();
await run.Completion;

Migrating from 2.1.2

SmartPipe.Extensions.Selectors.EfCoreSelector<T> moved into this package and stays reachable from SmartPipe.Extensions through type forwarding, with its namespace, constructors, and behaviour unchanged. It keeps its shipped borrowed-context semantics: it never disposes a caller-owned DbContext. New code uses the factory-based sources above, which own exactly one context per run.

Product Compatible and additional computed target framework versions.
.NET 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 (1)

Showing the top 1 NuGet packages that depend on SmartPipe.Extensions.EntityFrameworkCore:

Package Downloads
SmartPipe.Extensions

Compatibility facade and convenience bundle for SmartPipe.Core and its runtime integration packages. New applications should reference specific SmartPipe.Extensions.* packages. Retained 2.1.2 APIs use type forwarding or the frozen legacy DI/Hosting/Health cluster; removed HTTP/Polly APIs require migration and recompilation.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.1 151 10/13/2026
2.2.0 962 10/7/2026

First standalone release in 2.2.0. EfCoreSelector moves from the facade with forwarding; provider-neutral query sources use documented DbContext ownership. EF Core reflection paths do not carry a blanket trimming or NativeAOT guarantee.