Merged
Conversation
added 3 commits
January 8, 2026 11:24
- Created IIdentityProvider<TUserId> interface for automatic user ID retrieval - Updated DbContextBase to accept and use IIdentityProvider with fallback priority: 1. Manual WithUserId() override 2. IIdentityProvider.GetCurrentUserId() 3. Default null value - Updated DbContextFactory to pass IIdentityProvider to DbContext instances - Updated all sample and test contexts/factories to support new pattern - Added SampleIdentityProvider implementation for demonstration - Added Feature 13 to sample app demonstrating automatic user ID resolution - Updated README.md with comprehensive IIdentityProvider documentation - All 13 features now validated in CI/CD pipeline This enables automatic user auditing without manual WithUserId() calls while maintaining backward compatibility and allowing manual overrides when needed.
…ied constructors - Added IdentityProvider<TUserId> concrete implementation with SetCurrentUserId(), GetCurrentUserId(), and ClearCurrentUserId() methods - Added ServiceCollectionExtensions with AddIdentityProvider<TUserId>() and AddSingletonIdentityProvider<TUserId>() extension methods - Registered IdentityProvider<TUserId> in ModuleStartup using open generic registration - Simplified DbContextFactory<T, TUserId> to use single constructor with optional identityProvider parameter - Simplified DbContextBase<TUserId> to use single constructor with optional identityProvider parameter - Updated sample app to use built-in IdentityProvider instead of custom SampleIdentityProvider - Updated SampleDbContext and SampleDbContextFactory to use simplified single-constructor pattern - Added comprehensive documentation in README for built-in IdentityProvider usage - All tests passing
- Changed IIdentityProvider.GetCurrentUserId() to return non-nullable TUserId - Updated IdentityProvider, TestIdentityProvider, and SampleIdentityProvider implementations - Modified DbContextBase.GetEffectiveUserId() to handle non-nullable return type - Updated all test files to provide required IIdentityProvider parameter - Enhanced README.md with comprehensive feature documentation - Added detailed explanation of WithUserId() vs IIdentityProvider architecture - Documented real-world use cases for operation-level user attribution - All 61 tests passing
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.
No description provided.