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()); }
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>())); }
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()); }
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); }); }
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); } } } }
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)); }); }
public static PersistenceWireup UsingMongoPersistence(this Wireup wireup, string connectionName, IDocumentSerializer serializer) { return(new MongoPersistenceWireup(wireup, connectionName, serializer)); }
public SerializationWireup(Wireup inner, ISerialize serializer) : base(inner) { Container.Register(serializer); }
protected override void Context() { _wireup = Wireup.Init() // .UsingInMemoryPersistence() // the InMemoryPersistence should be the default serializer .UseTestableWireup(); }
public PersistenceWireup(Wireup inner) : base(inner) { Container.Register(TransactionScopeOption.Suppress); }
public static PersistenceWireup UsingMongoPersistence(this Wireup wireup, Func <string> connectionStringProvider, IDocumentSerializer serializer, MongoPersistenceOptions options = null) { return(new MongoPersistenceWireup(wireup, connectionStringProvider, serializer, options)); }
public static NoopDispatchSchedulerWireup DoNotDispatchCommits(this Wireup wireup) { return(new NoopDispatchSchedulerWireup(wireup)); }
public static SqlPersistenceWireup UsingSqlPersistence(this Wireup wireup, DbProviderFactory providerFactory, string connectionString) { var factory = new NetStandardConnectionFactory(providerFactory, connectionString); return(wireup.UsingSqlPersistence(factory)); }
public RavenPersistenceWireup(Wireup inner, Func <IDocumentStore> getStore) : this(inner) { _getStoreAction = getStore; }
protected Wireup(Wireup inner) { _inner = inner; }
public static SqlPersistenceWireup UsingSqlPersistence(this Wireup wireup, string connectionName) { var factory = new ConfigurationConnectionFactory(connectionName); return(wireup.UsingSqlPersistence(factory)); }
public static SqlPersistenceWireup UsingSqlPersistence(this Wireup wireup, IConnectionFactory factory) { return(new SqlPersistenceWireup(wireup, factory)); }
protected override Task Context() { _wireup = Wireup.Init() .UsingInMemoryPersistence(); return(Task.CompletedTask); }
protected override Task Context() { _wireup = Wireup.Init() .UsingInMemoryPersistence(); return(Task.FromResult(true)); }
public RavenPersistenceWireup(Wireup inner, string connectionName) : this(inner) { _getStoreAction = CreateStore; CreateWithConnectionStringName(connectionName); }
public static PersistenceWireup UsingInMemoryPersistence(this Wireup wireup) { wireup.With <IPersistStreams>(new InMemoryPersistenceEngine()); return(new PersistenceWireup(wireup)); }
protected override void Context() { _wireup = Wireup.Init() .UsingSqlPersistence("fakeConnectionString") .WithDialect(new Persistence.Sql.SqlDialects.MsSqlDialect()); }
public NoopDispatchSchedulerWireup(Wireup wireup) : base(wireup) { Container.Register <IScheduleDispatches>(c => new NoopDispatcherScheduler()); }
public static Wireup LogToOutputWindow(this Wireup wireup) { return(wireup.LogTo(type => new OutputWindowLogger(type))); }
public static AsynchronousDispatchSchedulerWireup UsingAsynchronousDispatchScheduler( this Wireup wireup, IDispatchCommits dispatcher) { return(new AsynchronousDispatchSchedulerWireup(wireup, dispatcher, DispatcherSchedulerStartup.Auto)); }
public static Wireup LogTo(this Wireup wireup, Func <Type, ILog> logger) { LogFactory.BuildLogger = logger; return(wireup); }
public static SynchronousDispatchSchedulerWireup UsingSynchronousDispatchScheduler(this Wireup wireup) { return(wireup.UsingSynchronousDispatchScheduler(null)); }
public static Wireup LogToConsoleWindow(this Wireup wireup) { return(wireup.LogTo(type => new ConsoleWindowLogger(type))); }