コード例 #1
0
        public MongoPersistenceWireup(Wireup inner, string connectionName, IDocumentSerializer serializer) : base(inner)
        {
            Logger.Debug("Configuring Mongo persistence engine.");

            var options = Container.Resolve <TransactionScopeOption>();

            if (options != TransactionScopeOption.Suppress)
            {
                Logger.Warn("MongoDB does not participate in transactions using TransactionScope.");
            }

            Container.Register(c => new MongoPersistenceFactory(connectionName, serializer).Build());
        }
        public MongoPersistenceWireup(Wireup inner, Func <string> connectionStringProvider, IDocumentSerializer serializer, MongoPersistenceOptions persistenceOptions)
            : base(inner)
        {
            Logger.LogDebug("Configuring Mongo persistence engine.");

            var options = Container.Resolve <TransactionScopeOption>();

            if (options != TransactionScopeOption.Suppress)
            {
                Logger.LogWarning("MongoDB does not participate in transactions using TransactionScope.");
            }

            Container.Register(_ => new MongoPersistenceFactory(connectionStringProvider, serializer, persistenceOptions).Build());
        }
コード例 #3
0
        public AsynchronousDispatchSchedulerWireup(Wireup wireup, IDispatchCommits dispatcher)
            : base(wireup)
        {
            var option = Container.Resolve <TransactionScopeOption>();

            if (option != TransactionScopeOption.Suppress)
            {
                Logger.Warn(Messages.SynchronousDispatcherTwoPhaseCommits);
            }

            Logger.Debug(Messages.AsyncDispatchSchedulerRegistered);
            DispatchTo(dispatcher ?? new NullDispatcher());
            Container.Register <IScheduleDispatches>(c => new AsynchronousDispatchScheduler(
                                                         c.Resolve <IDispatchCommits>(), c.Resolve <IPersistStreams>()));
        }
コード例 #4
0
        public SqlPersistenceWireup(Wireup wireup, IConnectionFactory connectionFactory)
            : base(wireup)
        {
            Logger.Debug(Messages.ConnectionFactorySpecified, connectionFactory);

            Logger.Verbose(Messages.AutoDetectDialect);
            Container.Register <ISqlDialect>(c => null); // auto-detect

            Container.Register(c => new SqlPersistenceFactory(
                                   connectionFactory,
                                   c.Resolve <ISerialize>(),
                                   c.Resolve <ISqlDialect>(),
                                   c.Resolve <TransactionScopeOption>(),
                                   _pageSize).Build());
        }
コード例 #5
0
        public RavenPersistenceWireup(Wireup inner) : base(inner)
        {
            Logger.Debug("Configuring Raven persistence engine.");

            Container.Register(
                c =>
                new RavenConfiguration
            {
                Serializer        = ResolveSerializer(c),
                ScopeOption       = c.Resolve <TransactionScopeOption>(),
                ConsistentQueries = _consistentQueries,
                MaxServerPageSize = _maxServerPageSize,
                RequestedPageSize = _pageSize,
            });

            Container.Register <IPersistStreams>(c => new RavenPersistenceEngine(_getStoreAction(), c.Resolve <RavenConfiguration>()));
        }
 public SynchronousDispatchSchedulerWireup(Wireup wireup, IDispatchCommits dispatcher, DispatcherSchedulerStartup startup)
     : base(wireup)
 {
     Logger.Debug(Messages.SyncDispatchSchedulerRegistered);
     Startup(startup);
     DispatchTo(dispatcher ?? new NullDispatcher());
     Container.Register <IScheduleDispatches>(c =>
     {
         var dispatchScheduler = new SynchronousDispatchScheduler(
             c.Resolve <IDispatchCommits>(),
             c.Resolve <IPersistStreams>());
         if (c.Resolve <DispatcherSchedulerStartup>() == DispatcherSchedulerStartup.Auto)
         {
             dispatchScheduler.Start();
         }
         return(dispatchScheduler);
     });
 }
コード例 #7
0
ファイル: Program.cs プロジェクト: oligarchy/ArrestedDev
        private static void EventStoreTest()
        {
            Guid StreamId = Guid.NewGuid();
            var  bus      = ServiceBusFactory.New(sbc =>
            {
            });

            var store = Wireup.Init()
                        .LogToOutputWindow()
                        .UsingInMemoryPersistence()
                        .UsingSqlPersistence("EventStoreConnection") // Connection string is in app.config
                        .WithDialect(new MsSqlDialect())
                        .EnlistInAmbientTransaction()                // two-phase commit
                        .InitializeStorageEngine()
                        .TrackPerformanceInstance("example")
                        .UsingJsonSerialization()
                        .Compress()
                        .EncryptWith(EncryptionKey)
                        .HookIntoPipelineUsing(new[] { new AuthorizationPipelineHook() })
                        .UsingSynchronousDispatchScheduler()
                        .DispatchTo(new DelegateMessageDispatcher(DispatchCommit))
                        .Build();

            using (store)
            {
                using (var stream = store.CreateStream(StreamId))
                {
                    stream.Add(new EventMessage()
                    {
                        Body = "Hello World!"
                    });
                    stream.CommitChanges(StreamId);
                }

                using (var stream = store.OpenStream(StreamId, 0, int.MinValue))
                {
                    foreach (var evnt in stream.CommittedEvents)
                    {
                        Console.WriteLine(evnt.Body);
                    }
                }
            }
        }
コード例 #8
0
        public EventUpconverterWireup(Wireup wireup) : base(wireup)
        {
            Logger.Debug(Messages.EventUpconverterRegistered);

            Container.Register(c =>
            {
                if (_registered.Count > 0)
                {
                    return(new EventUpconverterPipelineHook(_registered));
                }

                if (!_assembliesToScan.Any())
                {
                    _assembliesToScan.AddRange(GetAllAssemblies());
                }

                IDictionary <Type, Func <object, object> > converters = GetConverters(_assembliesToScan);
                return(new EventUpconverterPipelineHook(converters));
            });
        }
コード例 #9
0
 public static PersistenceWireup UsingMongoPersistence(this Wireup wireup, string connectionName, IDocumentSerializer serializer)
 {
     return(new MongoPersistenceWireup(wireup, connectionName, serializer));
 }
コード例 #10
0
 public SerializationWireup(Wireup inner, ISerialize serializer)
     : base(inner)
 {
     Container.Register(serializer);
 }
コード例 #11
0
 protected override void Context()
 {
     _wireup = Wireup.Init()
               // .UsingInMemoryPersistence() // the InMemoryPersistence should be the default serializer
               .UseTestableWireup();
 }
コード例 #12
0
 public PersistenceWireup(Wireup inner)
     : base(inner)
 {
     Container.Register(TransactionScopeOption.Suppress);
 }
コード例 #13
0
 public static PersistenceWireup UsingMongoPersistence(this Wireup wireup, Func <string> connectionStringProvider, IDocumentSerializer serializer, MongoPersistenceOptions options = null)
 {
     return(new MongoPersistenceWireup(wireup, connectionStringProvider, serializer, options));
 }
コード例 #14
0
 public static NoopDispatchSchedulerWireup DoNotDispatchCommits(this Wireup wireup)
 {
     return(new NoopDispatchSchedulerWireup(wireup));
 }
コード例 #15
0
        public static SqlPersistenceWireup UsingSqlPersistence(this Wireup wireup, DbProviderFactory providerFactory, string connectionString)
        {
            var factory = new NetStandardConnectionFactory(providerFactory, connectionString);

            return(wireup.UsingSqlPersistence(factory));
        }
コード例 #16
0
 public RavenPersistenceWireup(Wireup inner, Func <IDocumentStore> getStore) : this(inner)
 {
     _getStoreAction = getStore;
 }
コード例 #17
0
 protected Wireup(Wireup inner)
 {
     _inner = inner;
 }
コード例 #18
0
        public static SqlPersistenceWireup UsingSqlPersistence(this Wireup wireup, string connectionName)
        {
            var factory = new ConfigurationConnectionFactory(connectionName);

            return(wireup.UsingSqlPersistence(factory));
        }
コード例 #19
0
 public static SqlPersistenceWireup UsingSqlPersistence(this Wireup wireup, IConnectionFactory factory)
 {
     return(new SqlPersistenceWireup(wireup, factory));
 }
コード例 #20
0
 protected override Task Context()
 {
     _wireup = Wireup.Init()
               .UsingInMemoryPersistence();
     return(Task.CompletedTask);
 }
コード例 #21
0
 protected override Task Context()
 {
     _wireup = Wireup.Init()
               .UsingInMemoryPersistence();
     return(Task.FromResult(true));
 }
コード例 #22
0
 public RavenPersistenceWireup(Wireup inner, string connectionName) : this(inner)
 {
     _getStoreAction = CreateStore;
     CreateWithConnectionStringName(connectionName);
 }
コード例 #23
0
        public static PersistenceWireup UsingInMemoryPersistence(this Wireup wireup)
        {
            wireup.With <IPersistStreams>(new InMemoryPersistenceEngine());

            return(new PersistenceWireup(wireup));
        }
コード例 #24
0
 protected override void Context()
 {
     _wireup = Wireup.Init()
               .UsingSqlPersistence("fakeConnectionString")
               .WithDialect(new Persistence.Sql.SqlDialects.MsSqlDialect());
 }
コード例 #25
0
 public NoopDispatchSchedulerWireup(Wireup wireup)
     : base(wireup)
 {
     Container.Register <IScheduleDispatches>(c => new NoopDispatcherScheduler());
 }
コード例 #26
0
 public static Wireup LogToOutputWindow(this Wireup wireup)
 {
     return(wireup.LogTo(type => new OutputWindowLogger(type)));
 }
コード例 #27
0
 public static AsynchronousDispatchSchedulerWireup UsingAsynchronousDispatchScheduler(
     this Wireup wireup,
     IDispatchCommits dispatcher)
 {
     return(new AsynchronousDispatchSchedulerWireup(wireup, dispatcher, DispatcherSchedulerStartup.Auto));
 }
コード例 #28
0
 public static Wireup LogTo(this Wireup wireup, Func <Type, ILog> logger)
 {
     LogFactory.BuildLogger = logger;
     return(wireup);
 }
コード例 #29
0
 public static SynchronousDispatchSchedulerWireup UsingSynchronousDispatchScheduler(this Wireup wireup)
 {
     return(wireup.UsingSynchronousDispatchScheduler(null));
 }
コード例 #30
0
 public static Wireup LogToConsoleWindow(this Wireup wireup)
 {
     return(wireup.LogTo(type => new ConsoleWindowLogger(type)));
 }