22
22
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
23
24
24
using System ;
25
+ using System . Collections . Concurrent ;
25
26
using System . Collections . Generic ;
26
- using System . Linq ;
27
27
using System . Reflection ;
28
28
using EventFlow . Aggregates ;
29
29
using EventFlow . Commands ;
@@ -53,11 +53,11 @@ namespace EventFlow
53
53
{
54
54
public class EventFlowOptions : IEventFlowOptions
55
55
{
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 > ( ) ;
59
59
private readonly EventFlowConfiguration _eventFlowConfiguration = new EventFlowConfiguration ( ) ;
60
- private readonly List < Type > _jobTypes = new List < Type >
60
+ private readonly ConcurrentBag < Type > _jobTypes = new ConcurrentBag < Type >
61
61
{
62
62
typeof ( PublishCommandJob ) ,
63
63
typeof ( DispatchToAsynchronousEventSubscribersJob )
@@ -73,8 +73,13 @@ private EventFlowOptions(IServiceCollection serviceCollection)
73
73
RegisterDefaults ( ServiceCollection ) ;
74
74
}
75
75
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
+
78
83
public static IEventFlowOptions New ( IServiceCollection serviceCollection ) => new EventFlowOptions ( serviceCollection ) ;
79
84
80
85
public IEventFlowOptions ConfigureOptimisticConcurrencyRetry ( int retries , TimeSpan delayBeforeRetry )
@@ -212,7 +217,7 @@ private void RegisterDefaults(IServiceCollection serviceCollection)
212
217
serviceCollection . TryAddSingleton < ISagaDefinitionService , SagaDefinitionService > ( ) ;
213
218
serviceCollection . TryAddSingleton < ICommandDefinitionService , CommandDefinitionService > ( ) ;
214
219
215
- serviceCollection . AddSingleton < ILoadedVersionedTypes > ( r => new LoadedVersionedTypes (
220
+ serviceCollection . TryAddSingleton < ILoadedVersionedTypes > ( r => new LoadedVersionedTypes (
216
221
_jobTypes ,
217
222
_commandTypes ,
218
223
_aggregateEventTypes ,
0 commit comments