DX.Data
26.1.3.36
dotnet add package DX.Data --version 26.1.3.36
NuGet\Install-Package DX.Data -Version 26.1.3.36
<PackageReference Include="DX.Data" Version="26.1.3.36" />
<PackageVersion Include="DX.Data" Version="26.1.3.36" />
<PackageReference Include="DX.Data" />
paket add DX.Data --version 26.1.3.36
#r "nuget: DX.Data, 26.1.3.36"
#:package DX.Data@26.1.3.36
#addin nuget:?package=DX.Data&version=26.1.3.36
#tool nuget:?package=DX.Data&version=26.1.3.36
DX.Data
The base data-access abstraction shared by every store implementation in the DXWeb family (XPO, EF Core, Blazor WASM). Defines the IDataStore<TKey, TModel> contract that DX.Data.Xpo, DX.Data.EF, and their AutoMapper/Mapster variants all implement, plus a ready-to-use HTTP-based store for Blazor WASM clients. No DevExpress dependency.
Target frameworks: net462, net8.0, net9.0, net10.0
Install
dotnet add package DX.Data
You normally don't install this directly — it comes in transitively via DX.Data.Xpo, DX.Data.EF, or their mapper variants. Install it directly only if you're writing your own IDataStore implementation from scratch (e.g. against a different backend).
Core interfaces (Interfaces.cs)
public enum DataMode { Create, Update, Delete, Store }
public interface IDataStore<TKey, TModel>
{
Task<IDataResult<TKey, TModel>> DeleteAsync(TKey key);
string KeyField { get; }
TKey GetByKey(TKey key); // returns the model, not just the key — see remarks
TKey ModelKey(TModel model);
void SetModelKey(TModel model, TKey key);
Task<IDataResult<TKey, TModel>> StoreAsync(TModel model);
Task<IDataResult<TKey, TModel>> CreateAsync(TModel model);
Task<IDataResult<TKey, TModel>> UpdateAsync(TModel model);
}
public interface IQueryableDataStore<TKey, TModel> : IDataStore<TKey, TModel>
{
IQueryable<TModel> PaginateViaPrimaryKey(IQueryable<TModel> query, int skip, int take);
IQueryable<T> Query<T>();
IQueryable<TModel> Query();
}
Every concrete store in the DXWeb family (XPDataStore<...> in DX.Data.Xpo, EFDataStore<...> in DX.Data.EF) implements IQueryableDataStore<TKey, TModel>. StoreAsync is the "upsert" entry point: pass a model with a default/empty key to insert, or an existing key to update — CreateAsync/UpdateAsync are explicit variants of the same underlying logic.
IDataResult<TKey, TModel> wraps the outcome of any of the above calls:
public interface IDataResult<TKey, TModel>
{
bool Success { get; }
DataMode Mode { get; }
TModel? Model { get; }
Exception? Exception { get; }
}
DataResult<TKey, TModel> is the concrete implementation, constructed as new DataResult<TKey, TModel>(mode, propertyName, exception) — check .Success before trusting .Model.
Other supporting interfaces:
IIdentityRefreshToken—RefreshToken/RefreshTokenExpiryTimeproperties, implemented by identity user models acrossDX.Data.Xpo.IdentityandDX.Blazor.Identityso refresh-token flows work uniformly.IAssignable— a marker for types that know how to copy their own state from a source object (Assign(object source)), used by the reflection-basedPropertyExtensions.AssigninDX.Utils.IDataMapper<TKey, TModel, TDBModel>—[Obsolete]. Superseded by AutoMapper/Mapster-based mapping; kept only so old code referencing it still compiles.
ApiStore — Blazor WASM REST client (#if NET5_0_OR_GREATER)
public class ApiStore<TKey, TModel> : IDataStore<TKey, TModel>
{
public ApiStore(HttpClient client, string route);
// implements CreateAsync/UpdateAsync/StoreAsync/DeleteAsync via HTTP POST/PUT/DELETE
}
A drop-in IDataStore implementation for Blazor WASM (or any client-side .NET) that talks to a ControllerBase-style REST endpoint instead of a database directly. Create/Update/Store POST/PUT the model as JSON; Delete issues an HTTP DELETE by key. On a non-success response it deserializes the response body into a ValidationException so client code sees the same validation errors the server-side FluentValidation pipeline raised. Pair this with a matching ASP.NET Core controller that wraps a server-side XPDataStore/EFDataStore to get a full client↔server CRUD round-trip with one consistent validation error shape.
PredicateBuilder — composable LINQ expressions
public static class PredicateBuilder
{
public static Expression<Func<T, bool>> True<T>();
public static Expression<Func<T, bool>> False<T>();
public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> expr1, Expression<Func<T, bool>> expr2);
public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> expr1, Expression<Func<T, bool>> expr2);
}
Lets you build up a filter predicate incrementally (e.g. from a set of optional search filters) without hand-rolling expression-tree combination:
var predicate = PredicateBuilder.True<Customer>();
if (!string.IsNullOrEmpty(name))
predicate = predicate.And(c => c.Name.Contains(name));
if (activeOnly)
predicate = predicate.And(c => c.IsActive);
var results = store.Query().Where(predicate).ToList();
Notes
- This package has no direct DevExpress dependency — it's the shared contract layer that both the XPO-backed and EF-Core-backed stores implement, so switching your data-access technology later doesn't require rewriting consumer code that only depends on
IDataStore<TKey, TModel>. [Obsolete] DataMapper<TKey, TModel, TDBModel>(DataMapper.cs) is kept for source compatibility only — use the AutoMapper- or Mapster-backed store variants instead.
See the root README for the full package list and DevExpress version alignment notes.
| 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. |
| .NET Framework | net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.6.2
- FluentValidation (>= 9.5.4)
- Newtonsoft.Json (>= 13.0.4)
-
net10.0
- FluentValidation (>= 12.1.1)
- Newtonsoft.Json (>= 13.0.4)
-
net8.0
- FluentValidation (>= 12.1.1)
- Newtonsoft.Json (>= 13.0.4)
-
net9.0
- FluentValidation (>= 12.1.1)
- Newtonsoft.Json (>= 13.0.4)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on DX.Data:
| Package | Downloads |
|---|---|
|
DX.Data.Xpo
Several XPO Related Helper classes and abstract DX.Data.IDataStore implementation for use with XPO with FluentValidation and no Mapping logic |
|
|
DX.Data.EF
Abstract DX.Data.IDataStore implementation for use with EF with FluentValidation and no Mapping logic |
GitHub repositories
This package is not used by any popular GitHub repositories.
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 (no DevExpress dependency in this package; version bumped for consistency across the repo).