protected virtual IMongoPersistence CreatePersistence(MongoPersistenceOptions options) { return(new MongoPersistence(options)); }
public static PersistenceWireup UsingMongoPersistence(this Wireup wireup, Func <string> connectionStringProvider, IDocumentSerializer serializer, MongoPersistenceOptions options = null) { return(new MongoPersistenceWireup(wireup, connectionStringProvider, serializer, options)); }
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()); }
// little API change, let's pass in the connection string, do not assume we are reading from standard config files public static PersistenceWireup UsingMongoPersistence(this Wireup wireup, string connectionString, IDocumentSerializer serializer, MongoPersistenceOptions options = null) { return(new MongoPersistenceWireup(wireup, () => { if (string.IsNullOrWhiteSpace(connectionString)) { throw new NEventStore.Persistence.MongoDB.ConfigurationException(Messages.ConnectionNotFound.FormatWith(connectionString)); } return connectionString; }, serializer, options)); }
// System.Configuration will not be ported to dotnet core #if NET461 public static PersistenceWireup UsingMongoPersistence(this Wireup wireup, string connectionName, IDocumentSerializer serializer, MongoPersistenceOptions options = null) { return(new MongoPersistenceWireup(wireup, () => { var connectionStringSettings = ConfigurationManager.ConnectionStrings[connectionName]; if (connectionStringSettings == null) { throw new NEventStore.Persistence.MongoDB.ConfigurationException(Messages.ConnectionNotFound.FormatWith(connectionName)); } return connectionStringSettings.ConnectionString; }, serializer, options)); }
protected override IMongoPersistence CreatePersistence(MongoPersistenceOptions options) { return(new MongoPersistence <CustomChunk>(options)); }
protected override IMongoPersistence CreatePersistence(MongoPersistenceOptions options) { _serializer = new SerializerSpy(); options.MongoPayloadSerializer = _serializer; return(new MongoPersistence(options)); }
private static MongoPersistenceOptions ConfigureOptionsForTesting(MongoPersistenceOptions mongoPersistenceOptions) { mongoPersistenceOptions.PersistStreamHeadsOnBackgroundThread = false; return(mongoPersistenceOptions); }