Class EntityFrameworkCoreExtensions
- Namespace
- NextORM.EntityFrameworkCore
- Assembly
- nextorm.entityframeworkcore.dll
Bridges an EF Core DbContext to a nextorm IDataContext: the nextorm context runs on the same connection, enlists EF's active transaction, and reads its mapping from the EF model.
public static class EntityFrameworkCoreExtensions
- Inheritance
-
EntityFrameworkCoreExtensions
- Inherited Members
Remarks
The bridge shares EF Core's connection and, when EF has one active, its transaction: nextorm reads
and writes executed through the returned context participate in that transaction, while EF keeps
ownership of both — the bridge never closes, commits or rolls them back. It is not a
SaveChanges bridge: nextorm DML bypasses EF's change tracker, so rows it writes are unknown
to the tracker. The mapping read from the EF model lives in a process-wide cache, so at most one
mapping per CLR type is kept, and EF's non-relational InMemory provider is not supported.
Methods
CreateNextOrmContext(DbContext, Action<DataContextBuilder>?)
Creates a nextorm IDataContext over the EF Core connection of
dbContext, using the mapping read from dbContext's model.
public static IDataContext CreateNextOrmContext(this DbContext dbContext, Action<DataContextBuilder>? configure = null)
Parameters
dbContextDbContextThe EF Core context whose connection, model and current transaction are reused.
configureAction<DataContextBuilder>Optional nextorm configuration applied after the provider is selected from
dbContext.Database.ProviderName; use it to override provider defaults.
Returns
- IDataContext
An IDataContext that executes on the EF connection and, when
dbContext.Database.CurrentTransactionis active, inside that transaction.
Exceptions
- ArgumentNullException
dbContextis null.- InvalidOperationException
The EF provider reported by
ProviderNameis not one of the supported providers.