Skip to content

Add session configuration for ancillary stores#4134

Merged
jeremydmiller merged 1 commit intomasterfrom
lightweight-sessions-with-add-marten-store
Feb 15, 2026
Merged

Add session configuration for ancillary stores#4134
jeremydmiller merged 1 commit intomasterfrom
lightweight-sessions-with-add-marten-store

Conversation

@jeremydmiller
Copy link
Member

Summary

Closes #4131

  • Adds UseLightweightSessions(), UseIdentitySessions(), UseDirtyTrackedSessions(), and BuildSessionsWith<TFactory>() to MartenStoreExpression<T>, matching the existing MartenConfigurationExpression API for AddMarten()
  • Session factories are registered as keyed DI services (keyed by typeof(T)) so they don't conflict with the main store's ISessionFactory
  • A default DefaultSessionFactory keyed registration is added automatically for every ancillary store

Test plan

  • ancillary_store_use_lightweight_sessions — resolves LightweightSessionFactory, opens LightweightSession
  • ancillary_store_use_identity_sessions — resolves IdentitySessionFactory, opens IdentityMapDocumentSession
  • ancillary_store_use_dirty_tracked_sessions — resolves DirtyTrackedSessionFactory, opens DirtyCheckingDocumentSession
  • ancillary_store_build_sessions_with_custom_factory — resolves custom SpecialBuilder factory
  • ancillary_store_default_session_factory — default DefaultSessionFactory registered without explicit config
  • All existing bootstrapping tests continue to pass

🤖 Generated with Claude Code

AddMartenStore<T>() now supports UseLightweightSessions(), UseIdentitySessions(),
UseDirtyTrackedSessions(), and BuildSessionsWith<TFactory>() for configuring the
ISessionFactory via keyed DI services, matching the existing AddMarten() API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jeremydmiller jeremydmiller merged commit bfbd48c into master Feb 15, 2026
1 of 6 checks passed
@jeremydmiller jeremydmiller deleted the lightweight-sessions-with-add-marten-store branch February 15, 2026 02:22
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.

Support UseLightweightSessions() on fluent interface when calling AddMartenStore<T>

1 participant