Skip to content

fix(DX.Data.Xpo.Identity): user delete, claims/logins queries; identity tests and CI - #19

Merged
donwibier merged 4 commits into
masterfrom
fix/xpodxuser-delete-session
Oct 14, 2026
Merged

donwibier merged 4 commits into
masterfrom
fix/xpodxuser-delete-session

Conversation

@donwibier

Copy link
Copy Markdown
Owner

Fixes

  • Deleting a user always failed. XpoDxUser.OnDeleting built its role and claim collections without a session, so they used XpoDefault.Session, which XpoDatabase sets to null: UserManager.DeleteAsync threw ArgumentNullException. They use the user's own session now (as XpoDxRole.OnDeleting already did).
  • Claims and logins. Removing/replacing a user's claims, removing a login, and adding/removing/replacing a role's claims compared the key via ModelKey(...)/Equals inside the query, which XPO can't translate ("Custom function 'ModelKey' not found", "expression is not supported"). They use criteria with the key as a parameter now.
  • GetUsersInRoleAsync: stray ) in the criteria (parser error).
  • Mapster, reading user claims: the XPO claim's string key was mapped onto IdentityUserClaim.Id (an int) and threw FormatException; it's ignored now, as for role claims.

Tests

New DX.Data.Xpo.Identity.Tests (xunit, net8/9/10), 17 tests:

  • the XPO identity classes on an in-memory database, with XpoDefault.Session null as XpoDatabase leaves it: user and role delete, roles, claims, logins, tokens, upper-case fields;
  • the stores as AddXpoMapsterIdentityStores registers them, through UserManager/RoleManager: create, find, password, roles, claims, logins, role claims, delete.

Without the delete fix, 3 of the model tests fail; the store tests found the other fixes. New workflow Tests.yml runs these and the CronJobs tests on push to master and on PRs.

Versions

Bumped the changed packages and everything depending on DX.Data.Xpo.Identity (checked with dotnet pack that the nuspecs pick up the new versions):

Package Version
DX.Data.Xpo.Identity 26.1.3.37 → 26.1.3.38
DX.Data.Xpo.Identity.Mapster 26.1.3.37 → 26.1.3.38
DX.Data.Xpo.Identity.AutoMapper 26.1.3.36 → 26.1.3.37
DX.Blazor.Identity 26.1.3.30 → 26.1.3.31
DX.Blazor.Identity.Server 26.1.3.28 → 26.1.3.29
DX.Blazor.Identity.Wasm 26.1.3.28 → 26.1.3.29

Merging publishes these through Publish-NuGet-Packages.yml.

Not changed

RegisterIdentityServices.AddStores requires IConfiguration to look up an XpoDatabase it then doesn't use; harmless in a web app, the tests register an empty configuration.

🤖 Generated with Claude Code

donwibier and others added 4 commits October 14, 2026 10:44
XpoDxUser.OnDeleting built its role and claim collections without a session,
so they used XpoDefault.Session, which XpoDatabase sets to null: deleting a
user (UserManager.DeleteAsync) always threw ArgumentNullException.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Removing or replacing a user's claims, removing a login, and adding, removing
  or replacing a role's claims compared the key with ModelKey(...)/Equals inside
  the query, which XPO can't translate; they use criteria with the key as a
  parameter now.
- GetUsersInRoleAsync: stray ')' in the criteria (parser error).
- Mapster: reading a user claim mapped the XPO claim's string key onto
  IdentityUserClaim.Id (an int) and threw; it's ignored, as for role claims.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DX.Data.Xpo.Identity.Tests: the XPO identity classes on an in-memory database
(user and role delete, claims, logins, tokens, upper-case fields) and the stores
as AddXpoMapsterIdentityStores registers them, through UserManager and
RoleManager. Tests.yml runs these and the CronJobs tests on push and PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DX.Data.Xpo.Identity and DX.Data.Xpo.Identity.Mapster carry the fixes; the
packages that depend on DX.Data.Xpo.Identity are bumped too, so a fresh install
of any of them resolves the fixed version:

  DX.Data.Xpo.Identity            26.1.3.37 -> 26.1.3.38
  DX.Data.Xpo.Identity.Mapster    26.1.3.37 -> 26.1.3.38
  DX.Data.Xpo.Identity.AutoMapper 26.1.3.36 -> 26.1.3.37
  DX.Blazor.Identity              26.1.3.30 -> 26.1.3.31
  DX.Blazor.Identity.Server       26.1.3.28 -> 26.1.3.29
  DX.Blazor.Identity.Wasm         26.1.3.28 -> 26.1.3.29

Verified with dotnet pack that the nuspecs depend on DX.Data.Xpo.Identity
26.1.3.38 (and DX.Blazor.Identity 26.1.3.31).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@donwibier
donwibier merged commit 43ca8cd into master Oct 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant