protected async Task AddEventAsync( NpgsqlConnectionFactory connectionFactory, GameId gameId, GameEvent gameEvent) { var gameEventStore = new PostgresGameEventStore(connectionFactory); await gameEventStore.AddEventAsync(gameId, gameEvent, CancellationToken.None); }
public ILogMaintainer Create(string connectionString, PHmiModel.Entities.Log log, ITimeService timeService) { var npgsqlConnectionFactory = new NpgsqlConnectionFactory(connectionString); var logRepository = new LogRepository(log.Id); using (var connection = npgsqlConnectionFactory.Create()) { logRepository.EnsureTable(connection); } return(new LogMaintainer( log, logRepository, timeService, npgsqlConnectionFactory)); }
private static DbConnection BuildConnection(IConnectionSettings connectionSettings) { if (null == connectionSettings) { connectionSettings = ConnectionSettings; } switch (connectionSettings.ProviderInvariantName) { case DataConfiguration.SqlServerCompactProviderInvariantName: { var connectionFactory = new SqlCeConnectionFactory(DataConfiguration.SqlServerCompactProviderInvariantName); return(connectionFactory.CreateConnection(connectionSettings.ConnectionString)); } case DataConfiguration.SqlServerProviderInvariantName: { var connectionFactory = new SqlConnectionFactory(); return(connectionFactory.CreateConnection(connectionSettings.ConnectionString)); } case DataConfiguration.MySqlProviderInvariantName: { var connectionFactory = new MySqlConnectionFactory(); return(connectionFactory.CreateConnection(connectionSettings.ConnectionString)); } case DataConfiguration.PostgreSqlProviderInvariantName: { var connectionFactory = new NpgsqlConnectionFactory(); return(connectionFactory.CreateConnection(connectionSettings.ConnectionString)); } case DataConfiguration.OracleDBProviderInvariantName: { var connectionFactory = new OracleConnectionFactory(); return(connectionFactory.CreateConnection(connectionSettings.ConnectionString)); } default: throw new InvalidOperationException("connectionSettings.ProviderInvariantName == " + connectionSettings.ProviderInvariantName); } }
protected async Task <GameId> CreateGameAsync( NpgsqlConnectionFactory connectionFactory, NewPlayer?player1 = null, NewPlayer?player2 = null) { var gameStore = new PostgresGameStore(connectionFactory); var newGame = new NewGame( players: new PlayerList( randomFirstPlayer: false, player1 ?? new NewPlayer(Player1, PlayerType.User), player2 ?? new NewPlayer(Player2, PlayerType.User)), firstPlayerIndex: 0, seed: new Seed(42), boardType: BoardType.OneEyedJack, numSequencesToWin: 2); return(await gameStore.PersistNewGameAsync(newGame, CancellationToken.None)); }
public IAlarmsRunTarget Create(string connectionString, IProject project, AlarmCategory alarmCategory, ITimeService timeService) { var npgsqlConnectionFactory = new NpgsqlConnectionFactory(connectionString); var alarmsRepository = new AlarmsRepository(alarmCategory.Id); using (var connection = npgsqlConnectionFactory.Create()) { alarmsRepository.EnsureTable(connection); } return(new AlarmsRunTarget( alarmCategory, new NotificationReporter(timeService) { LifeTime = TimeSpan.FromTicks(0) }, alarmsRepository, project, timeService, npgsqlConnectionFactory)); }
public ITrendsRunTarget Create(string connectionString, IProject project, TrendCategory trendCategory, ITimeService timeService) { var npgsqlConnectionFactory = new NpgsqlConnectionFactory(connectionString); var repositoryFactory = new TrendsRepositoryFactory( npgsqlConnectionFactory, trendCategory.Id, trendCategory.TrendTags.Select(t => t.Id).ToArray()); using (var repository = repositoryFactory.Create()) { repository.EnsureTables(); } return(new TrendsRunTarget( trendCategory, new NotificationReporter(timeService) { LifeTime = TimeSpan.FromTicks(0) }, repositoryFactory, project, timeService, new TrendTableSelector())); }
public PostgresGameEventStore(NpgsqlConnectionFactory connectionFactory) { _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory)); }
public PostgresSimulationStore(NpgsqlConnectionFactory connectionFactory) { _connectionFactory = connectionFactory; }
public PostgresGameStore(NpgsqlConnectionFactory connectionFactory) { _connectionFactory = connectionFactory; }
public PostgresGameListProvider(NpgsqlConnectionFactory connectionFactory) { _connectionFactory = connectionFactory; }