DX.Data.Xpo.Identity.Mapster
26.1.3.40
dotnet add package DX.Data.Xpo.Identity.Mapster --version 26.1.3.40
NuGet\Install-Package DX.Data.Xpo.Identity.Mapster -Version 26.1.3.40
<PackageReference Include="DX.Data.Xpo.Identity.Mapster" Version="26.1.3.40" />
<PackageVersion Include="DX.Data.Xpo.Identity.Mapster" Version="26.1.3.40" />
<PackageReference Include="DX.Data.Xpo.Identity.Mapster" />
paket add DX.Data.Xpo.Identity.Mapster --version 26.1.3.40
#r "nuget: DX.Data.Xpo.Identity.Mapster, 26.1.3.40"
#:package DX.Data.Xpo.Identity.Mapster@26.1.3.40
#addin nuget:?package=DX.Data.Xpo.Identity.Mapster&version=26.1.3.40
#tool nuget:?package=DX.Data.Xpo.Identity.Mapster&version=26.1.3.40
DX.Data.Xpo.Identity.Mapster
Wires up DX.Data.Xpo.Identity's abstract stores with Mapster and a set of default XPO persistent entities — the AutoMapper-free alternative to DX.Data.Xpo.Identity.AutoMapper. This is the package to use if your Identity project must stay on net462.
Target frameworks: net462, net8.0, net9.0, net10.0
DevExpress dependency: transitive, via DX.Data.Xpo (26.1.*)
Behaviour changes in 26.1.3.40
AddXpoMapsterIdentityStoresno longer writes the identity mapping rules intoTypeAdapterConfig.GlobalSettings. The stores use a mapper of their own: a copy of your application's Mapster config with the identity rules added, built when the first store is created (later changes toGlobalSettingsare not seen by the stores).- If your own code maps identity types through
GlobalSettingsand relied on those rules, callRegisterXPIdentityMapsterConfiguration()yourself, or useApplyXPIdentityMapsterConfiguration(config)to add them to a config of your own. LockoutEndis mapped toLockoutEndDateUtc, so lockouts are persisted. See the DX.Data.Xpo.Identity release notes for the security fix this version includes.
Install
dotnet add package DX.Data.Xpo.Identity.Mapster
Install this or DX.Data.Xpo.Identity.AutoMapper — never both (see the root README).
Concrete stores (XPIdentityStores.cs)
Mirrors the AutoMapper package exactly, using Mapster's IMapper/ProjectToType<T>() instead:
public class XPMapsterUserStore<...> : XPBaseUserStore<...> { public XPMapsterUserStore(IDataLayer, MapsterMapper.IMapper, IValidator<TXPOUser>); }
public class XPMapsterRoleStore<...> : XPBaseRoleStore<...> { /* ... */ }
public class XPMapsterUserLoginStore<...> : XPBaseUserLoginStore<...> { /* ... */ }
public class XPMapsterUserClaimStore<...> : XPBaseUserClaimStore<...> { /* ... */ }
public class XPMapsterUserTokenStore<...> : XPBaseUserTokenStore<...> { /* ... */ }
public class XPMapsterRoleClaimStore<...> : XPBaseRoleClaimStore<...> { /* ... */ }
One-line registration (RegisterServices.cs)
public static IServiceCollection AddXpoMapsterIdentityStores<TUser>(this IdentityBuilder builder, string connectionName);
// + more-generic overloads for supplying your own persistent XPO entity types
Unlike the AutoMapper variant, this registers services.AddTransient<IMapper, Mapper>() and calls services.RegisterXPIdentityMapsterConfiguration<...>() instead of an AutoMapper Profile. XPIdentityMapsterConfig.RegisterXPIdentityMapsterConfiguration<...> (also shipped in this package) configures TypeAdapterConfig<TUser, TXPOUser>.NewConfig().Ignore(...) for the collection-navigation properties, plus .AfterMapping() callbacks that restore FK id fields (like RoleId/UserId) that Mapster's .Ignore() would otherwise blank out on the mapped target — a subtlety AutoMapper's profile doesn't need to worry about because of how it handles ignored members differently.
Usage
services
.AddIdentity<ApplicationUser>(options => { /* lockout, password policy, etc. */ })
.AddXpoMapsterIdentityStores<ApplicationUser>("DefaultConnection")
.AddDefaultTokenProviders();
See the root README for the full config sample including JWT/token service setup used alongside DX.Blazor.Identity.
Notes
- If you're on net462 and were using
DX.Data.Xpo.Identity.AutoMapperbefore26.1.3.34, this package is your migration path — the registration call and store shapes are deliberately identical (AddXpoMapsterIdentityStoresvsAddXpoAutoMapperIdentityStores), only the underlying mapper changes. - For Blazor Server/WASM login UI on top of this, see
DX.Blazor.Identity.
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
- DX.Data.Xpo (>= 26.1.3.40)
- DX.Data.Xpo.Identity (>= 26.1.3.40)
- DX.Data.Xpo.Mapster (>= 26.1.3.36)
- Mapster (>= 7.2.0)
-
net10.0
- DX.Data.Xpo (>= 26.1.3.40)
- DX.Data.Xpo.Identity (>= 26.1.3.40)
- DX.Data.Xpo.Mapster (>= 26.1.3.36)
- Mapster (>= 10.0.14)
-
net8.0
- DX.Data.Xpo (>= 26.1.3.40)
- DX.Data.Xpo.Identity (>= 26.1.3.40)
- DX.Data.Xpo.Mapster (>= 26.1.3.36)
- Mapster (>= 10.0.14)
-
net9.0
- DX.Data.Xpo (>= 26.1.3.40)
- DX.Data.Xpo.Identity (>= 26.1.3.40)
- DX.Data.Xpo.Mapster (>= 26.1.3.36)
- Mapster (>= 10.0.14)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
26.1.3.40: Built against DX.Data.Xpo.Identity 26.1.3.40 (security fix: redeemed recovery codes stayed valid; lockout is persisted; see its release notes). LockoutEnd is mapped to LockoutEndDateUtc. The stores use a mapper of their own: AddXpoMapsterIdentityStores no longer writes the identity rules into TypeAdapterConfig.GlobalSettings (which also made parallel registrations throw). Behaviour change: code that maps identity types through GlobalSettings itself must call RegisterXPIdentityMapsterConfiguration(); ApplyXPIdentityMapsterConfiguration(config) adds the rules to a config of your own.
26.1.3.39: Rebuilt against DX.Data.Xpo.Identity 26.1.3.39 (the Microsoft.Extensions.Identity packages per target framework (8.0 for net8.0, 9.0 for net9.0, 10.0 for net10.0): 10.0 on net8.0 brought Microsoft.AspNetCore.Cryptography.Internal 10 into .NET 8 apps and broke Data Protection (tokens, antiforgery) on Linux.)
26.1.3.37: Rebuilt against DX.Data.Xpo.Identity 26.1.3.37 / DX.Data.Xpo.Mapster 26.1.3.34 to pick up the System.Security.Cryptography.Xml 8.0.4 fix (NU1903) transitively.
26.1.3.36: Added a README.md with technical documentation, now embedded in the package via PackageReadmeFile.
26.1.3.35: Rebuilt against DX.Data.Xpo.Identity 26.1.3.35 / DX.Data.Xpo.Mapster 26.1.3.32 to pick up DevExpress v26.1.3 transitively.