Repository navigation
fix(DX.Data.Xpo.Identity): user delete, claims/logins queries; identity tests and CI - #19
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes
XpoDxUser.OnDeletingbuilt its role and claim collections without a session, so they usedXpoDefault.Session, whichXpoDatabasesets to null:UserManager.DeleteAsyncthrewArgumentNullException. They use the user's own session now (asXpoDxRole.OnDeletingalready did).ModelKey(...)/Equalsinside 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).IdentityUserClaim.Id(an int) and threwFormatException; it's ignored now, as for role claims.Tests
New
DX.Data.Xpo.Identity.Tests(xunit, net8/9/10), 17 tests:XpoDefault.Sessionnull asXpoDatabaseleaves it: user and role delete, roles, claims, logins, tokens, upper-case fields;AddXpoMapsterIdentityStoresregisters them, throughUserManager/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.ymlruns 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 withdotnet packthat the nuspecs pick up the new versions):Merging publishes these through
Publish-NuGet-Packages.yml.Not changed
RegisterIdentityServices.AddStoresrequiresIConfigurationto look up anXpoDatabaseit then doesn't use; harmless in a web app, the tests register an empty configuration.🤖 Generated with Claude Code