File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed
src/NServiceBus.Core/Persistence Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -51,8 +51,8 @@ public static void ConfigurePersistence(this SettingsHolder settings)
5151
5252 static void ValidateSagaAndOutboxUseSamePersistence ( this SettingsHolder settings , IReadOnlyCollection < EnabledPersistence > enabledPersistences )
5353 {
54- var sagaPersisterDefinition = enabledPersistences . FirstOrDefault ( p => p . SelectedStorages . Contains ( StorageType . Sagas . Instance ) ) ? . Definition ;
55- var outboxPersisterDefinition = enabledPersistences . FirstOrDefault ( p => p . SelectedStorages . Contains ( StorageType . Outbox . Instance ) ) ? . Definition ;
54+ var sagaPersisterDefinition = enabledPersistences . FirstOrDefault ( p => p . SelectedStorages . Contains < StorageType . Sagas > ( ) ) ? . Definition ;
55+ var outboxPersisterDefinition = enabledPersistences . FirstOrDefault ( p => p . SelectedStorages . Contains < StorageType . Outbox > ( ) ) ? . Definition ;
5656 var bothFeaturesEnabled = settings . IsFeatureEnabled ( typeof ( Features . Sagas ) ) && settings . IsFeatureEnabled ( typeof ( Features . Outbox ) ) ;
5757
5858 if ( sagaPersisterDefinition != null
@@ -68,7 +68,7 @@ internal static bool HasSupportFor<T>(this IReadOnlySettings settings) where T :
6868 {
6969 _ = settings . TryGet ( out IReadOnlyCollection < StorageType > supportedStorages ) ;
7070
71- return supportedStorages ? . Contains ( StorageType . Get < T > ( ) ) ?? false ;
71+ return supportedStorages . Contains < T > ( ) ;
7272 }
7373
7474 static readonly ILog Logger = LogManager . GetLogger ( typeof ( PersistenceComponent ) ) ;
Original file line number Diff line number Diff line change 1+ #nullable enable
2+
3+ namespace NServiceBus ;
4+
5+ using System . Collections . Generic ;
6+ using System . Linq ;
7+
8+ static class StorageTypeCollectionExtensions
9+ {
10+ extension ( IReadOnlyCollection < StorageType > ? storageTypes )
11+ {
12+ public bool Contains < TStorage > ( ) where TStorage : StorageType
13+ {
14+ if ( storageTypes is null )
15+ {
16+ return false ;
17+ }
18+
19+ var storageType = StorageType . Get < TStorage > ( ) ;
20+ return storageTypes . Contains ( storageType ) ;
21+ }
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments