private static IStoreEvents BuildEventStore(NanoContainer context) { var concurrentHook = new OptimisticPipelineHook(); var dispatcherHook = new DispatchPipelineHook(context.Resolve <IDispatchCommits>()); var pipelineHooks = context.Resolve <ICollection <IPipelineHook> >() ?? new IPipelineHook[0]; pipelineHooks = new IPipelineHook[] { concurrentHook, dispatcherHook }.Concat(pipelineHooks).ToArray(); return(new OptimisticEventStore(context.Resolve <IPersistStreams>(), pipelineHooks)); }
private static IStoreEvents BuildEventStore(NanoContainer context) { var scopeOption = context.Resolve <TransactionScopeOption>(); var concurrentHook = scopeOption == TransactionScopeOption.Suppress ? new OptimisticPipelineHook() : null; var dispatcherHook = new DispatchPipelineHook(context.Resolve <IDispatchCommits>()); var pipelineHooks = context.Resolve <ICollection <IPipelineHook> >() ?? new IPipelineHook[0]; pipelineHooks = new IPipelineHook[] { concurrentHook, dispatcherHook } .Concat(pipelineHooks) .Where(x => x != null) .ToArray(); return(new OptimisticEventStore(context.Resolve <IPersistStreams>(), pipelineHooks)); }