2222// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2323
2424using System ;
25+ using System . Collections . Concurrent ;
2526using System . Collections . Generic ;
26- using System . Linq ;
2727using System . Reflection ;
2828using EventFlow . Aggregates ;
2929using EventFlow . Commands ;
@@ -53,11 +53,11 @@ namespace EventFlow
5353{
5454 public class EventFlowOptions : IEventFlowOptions
5555 {
56- private readonly List < Type > _aggregateEventTypes = new List < Type > ( ) ;
57- private readonly List < Type > _sagaTypes = new List < Type > ( ) ;
58- private readonly List < Type > _commandTypes = new List < Type > ( ) ;
56+ private readonly ConcurrentBag < Type > _aggregateEventTypes = new ConcurrentBag < Type > ( ) ;
57+ private readonly ConcurrentBag < Type > _sagaTypes = new ConcurrentBag < Type > ( ) ;
58+ private readonly ConcurrentBag < Type > _commandTypes = new ConcurrentBag < Type > ( ) ;
5959 private readonly EventFlowConfiguration _eventFlowConfiguration = new EventFlowConfiguration ( ) ;
60- private readonly List < Type > _jobTypes = new List < Type >
60+ private readonly ConcurrentBag < Type > _jobTypes = new ConcurrentBag < Type >
6161 {
6262 typeof ( PublishCommandJob ) ,
6363 typeof ( DispatchToAsynchronousEventSubscribersJob )
@@ -73,8 +73,13 @@ private EventFlowOptions(IServiceCollection serviceCollection)
7373 RegisterDefaults ( ServiceCollection ) ;
7474 }
7575
76- public static IEventFlowOptions New ( ) => new EventFlowOptions ( new ServiceCollection ( )
77- . AddLogging ( b => b . AddConsole ( ) ) ) ;
76+ public static IEventFlowOptions New ( ) =>
77+ new EventFlowOptions (
78+ new ServiceCollection ( )
79+ . AddLogging ( b => b
80+ . SetMinimumLevel ( LogLevel . Trace )
81+ . AddConsole ( ) ) ) ;
82+
7883 public static IEventFlowOptions New ( IServiceCollection serviceCollection ) => new EventFlowOptions ( serviceCollection ) ;
7984
8085 public IEventFlowOptions ConfigureOptimisticConcurrencyRetry ( int retries , TimeSpan delayBeforeRetry )
@@ -212,7 +217,7 @@ private void RegisterDefaults(IServiceCollection serviceCollection)
212217 serviceCollection . TryAddSingleton < ISagaDefinitionService , SagaDefinitionService > ( ) ;
213218 serviceCollection . TryAddSingleton < ICommandDefinitionService , CommandDefinitionService > ( ) ;
214219
215- serviceCollection . AddSingleton < ILoadedVersionedTypes > ( r => new LoadedVersionedTypes (
220+ serviceCollection . TryAddSingleton < ILoadedVersionedTypes > ( r => new LoadedVersionedTypes (
216221 _jobTypes ,
217222 _commandTypes ,
218223 _aggregateEventTypes ,
0 commit comments