protected internal IPersistence Create(bool dropOnInit) { Connect(); _logger.LogInformation("Starting test #{number}", _testRunId); _options = CreateOptions(); _sqlPersistence = new MsSqlPersistence(_options); if (dropOnInit) { _sqlPersistence.DestroyAllAsync(CancellationToken.None).Wait(); } _sqlPersistence.InitAsync(CancellationToken.None).Wait(); _logger.LogInformation("Test #{number} started", _testRunId); return(_sqlPersistence); }
private IPersistence Create() { _id = Interlocked.Increment(ref _staticId); _logger.LogInformation("Starting test #{number}", _id); _options = new MsSqlPersistenceOptions(LoggerFactory) { ConnectionString = ConnectionString, StreamsTableName = "streams_" + _id + "_" + GetType().Name, Serializer = new JsonMsSqlSerializer() }; _sqlPersistence = new MsSqlPersistence(_options); _sqlPersistence.DestroyAllAsync(CancellationToken.None).Wait(); _sqlPersistence.InitAsync(CancellationToken.None).Wait(); _logger.LogInformation("Test #{number} started", _id); return(_sqlPersistence); }
public static async Task <IPersistence> CreateSqlServerAsync( string connectionString, string tablename, INStoreLoggerFactory loggerFactory) { var options = new MsSqlPersistenceOptions(loggerFactory) { ConnectionString = connectionString, StreamsTableName = tablename, Serializer = new JsonMsSqlSerializer() }; var persistence = new MsSqlPersistence(options); await persistence.DestroyAllAsync(CancellationToken.None); await persistence.InitAsync(CancellationToken.None); return(persistence); }
protected internal IPersistence Create(bool dropOnInit) { Connect(); _logger.LogInformation("Starting test #{number}", _testRunId); _options = new MsSqlPersistenceOptions(LoggerFactory) { ConnectionString = _connectionString, StreamsTableName = "streams_" + _testRunId + "_" + GetType().Name, Serializer = new JsonMsSqlSerializer() }; _sqlPersistence = new MsSqlPersistence(_options); if (dropOnInit) { _sqlPersistence.DestroyAllAsync(CancellationToken.None).Wait(); } _sqlPersistence.InitAsync(CancellationToken.None).Wait(); _logger.LogInformation("Test #{number} started", _testRunId); return(_sqlPersistence); }