DX.Data.EF 26.1.3.36

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

DX.Data.EF

Abstract DX.Data.IDataStore implementation backed by Entity Framework (EF Core on net8.0/net9.0/net10.0, classic System.Data.Entity on net462). This package contains no mapping implementation — pick DX.Data.EF.AutoMapper or DX.Data.EF.Mapster on top of it, or subclass EFDataStore directly and write your own mapping.

Target frameworks: net462, net8.0, net9.0, net10.0 DevExpress dependency: none — this package works with a plain EF Core DbContext and has nothing to do with XPO.

Install

dotnet add package DX.Data.EF

EFDatabase<TEFContext> — transaction helper (EFDatabase.cs)

public class EFDatabase<TEFContext> where TEFContext : DbContext, new()
{
    public void Execute(Action<TEFContext> action);
    public T Execute<T>(Func<TEFContext, T> action);
    public Task ExecuteAsync(Func<TEFContext, Task> action);
    public Task<T> ExecuteAsync<T>(Func<TEFContext, Task<T>> action);
}

Wraps a DbContext instance plus an explicit transaction (IDbContextTransaction on NET6_0_OR_GREATER, classic DbContextTransaction on net462) so callers get automatic commit/rollback semantics without repeating BeginTransaction/Commit/Rollback boilerplate at every call site.

EFDataStore<TEFContext, TKey, TModel, TDBModel> — the abstract store base (EFDataStore.cs)

public abstract class EFDataStore<TEFContext, TKey, TModel, TDBModel> : IQueryableDataStore<TKey, TModel>
    where TEFContext : DbContext
    where TDBModel : class
{
    protected EFDataStore(TEFContext context, IValidator<TDBModel> validator);

    public abstract IQueryable<T> Query<T>();
    protected IQueryable<TDBModel> EFQuery();
    protected TModel EFGetByKey(TKey key);

    protected abstract TModel GetByKey(TKey key);
    protected abstract TDBModel ToDBModel(TModel model);
    protected abstract TModel ToModel(TDBModel dbModel);
    protected abstract TKey ModelKey(TModel model);
    protected abstract void SetModelKey(TModel model, TKey key);
    protected abstract TKey DBModelKey(TDBModel dbModel);

    public Task<TResult> TransactionalExecAsync<TResult>(Func<TEFContext, Task<TResult>> action);

    public Task<IDataResult<TKey, TModel>> StoreAsync(TModel model); // Add or Entry(...).State = Modified
    public Task<IDataResult<TKey, TModel>> DeleteAsync(TKey key);
    public Task<IDataResult<TKey, TModel>> DeleteAsync(TModel model);
}

This is the EF-Core mirror of DX.Data.Xpo's XPDataStore — same shape, same IQueryableDataStore<TKey, TModel> contract, so consumer code written against the abstraction doesn't care whether the underlying store is XPO- or EF-backed. StoreAsync decides between DbContext.Set<TDBModel>().Add(...) and Entry(...).State = EntityState.Modified based on whether the model's key is set, then commits inside TransactionalExecAsync.

Minimal usage (writing your own mapping, no AutoMapper/Mapster)

public class CustomerStore : EFDataStore<AppDbContext, int, CustomerDto, Customer>
{
    public CustomerStore(AppDbContext context, IValidator<Customer> validator) : base(context, validator) { }

    public override IQueryable<T> Query<T>() => /* project Customer -> T yourself */;
    protected override CustomerDto GetByKey(int key) => /* ... */;
    protected override Customer ToDBModel(CustomerDto model) => /* ... */;
    protected override CustomerDto ToModel(Customer dbModel) => /* ... */;
    protected override int ModelKey(CustomerDto model) => model.Id;
    protected override void SetModelKey(CustomerDto model, int key) => model.Id = key;
    protected override int DBModelKey(Customer dbModel) => dbModel.Id;
}

In practice, most consumers skip this and derive from EFAutoMapperDataStore/EFMapsterDataStore instead (see the sibling packages), which implement the mapping members via a configured IMapper.

Notes

  • No direct DevExpress dependency — bumped alongside the DXWeb release wave purely for repo-wide version consistency, not because of any DevExpress upgrade.
  • Depends on DX.Data (for IQueryableDataStore/IDataResult) and DX.Utils.
  • net462 uses EntityFramework 6.4.4 (classic EF6); net8.0/9.0/10.0 use the matching Microsoft.EntityFrameworkCore major version.

See the root README for the full package list and DevExpress version alignment notes.

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. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on DX.Data.EF:

Package Downloads
DX.Data.EF.Mapster

DX.Data.IDataStore implementation for use with EF with FluentValidation and Mapster

DX.Data.EF.AutoMapper

DX.Data.IDataStore implementation for use with EF with FluentValidation and AutoMapper

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
26.1.3.37 138 11/4/2026
26.1.3.36 222 7/31/2026
26.1.3.35 170 7/14/2026
25.2.3.34 219 4/7/2026
24.2.3.34 362 12/13/2024
23.2.3.34 259 9/25/2024
23.2.3.33 334 9/17/2024
23.2.3.32 290 9/17/2024
23.2.3.31 400 1/11/2024
20.2.3.7 310 12/14/2023
20.2.3.6 399 4/25/2023
20.2.3.5 529 1/4/2023
20.2.3.2 622 9/13/2021
20.2.3.1 593 3/12/2021

26.1.3.36: Added a README.md with technical documentation, now embedded in the package via PackageReadmeFile.
26.1.3.35: Rebuilt to align with the DXWeb v26.1.3 release wave and pick up the latest DX.Data/DX.Utils dependency versions (no direct DevExpress dependency in this package).
23.2.3.30: Data.DataStore plus Validator and Mapper have been moved and simplified into package DX.Data
BREAKING CHANGES:
Data base classes moved to DX.Data package
DX.Data package refactored to use FluentValidation with simplyfied validation logic

23.2.3.23: Upgraded to .NET8 and DX v23.2.3 Dropped support for .NETStandard!