private static void ConfigureRepositories(IServiceCollection services, bool useInMemoryDatabase, int hiloLargeIntervalSize, int hiloSmallIntervalSize)
        {
            if (useInMemoryDatabase)
            {
                services.AddSingleton <IIdGenerator>(HiLoIdGenerator.InMemoryHiloGIdGenerator(
                                                         hiloLargeIntervalSize, hiloSmallIntervalSize, hiloSmallIntervalSize));
                services.AddSingleton <IUnitOfWork, InMemoryUnitOfWork>();

                services.AddSingleton <IAuthUserRepository, InMemoryAuthUserRepository>();
                services.AddSingleton <IRoleRepository, InMemoryRoleRepository>();
                services.AddSingleton <IAdminLogRepository, InMemoryAdminLogRepository>();
                services.AddSingleton <IUserRepository, InMemoryUserRepository>();
                services.AddSingleton <IGameRepository, InMemoryGameRepository>();
                services.AddSingleton <IGameStateRepository, InMemoryGameStateRepository>();
            }
            else
            {
                services.AddSingleton <IIdGenerator>(HiLoIdGenerator.DbHiloGIdGenerator(
                                                         hiloLargeIntervalSize, hiloSmallIntervalSize, hiloSmallIntervalSize));
                services.AddSingleton <IUnitOfWork, DbUnitOfWork>();

                services.AddSingleton <IAuthUserRepository, DbAuthUserRepository>();
                services.AddSingleton <IRoleRepository, DbRoleRepository>();
                services.AddSingleton <IAdminLogRepository, DbAdminLogRepository>();
                services.AddSingleton <IUserRepository, DbUserRepository>();
                services.AddSingleton <IGameRepository, DbGameRepository>();
                services.AddSingleton <IGameStateRepository, DbGameStateRepository>();
            }
        }
Example #2
0
 public DbApiTester()
 {
     IdGenerator        = HiLoIdGenerator.DbHiloGIdGenerator(1, 1, 1);
     UnitOfWork         = new DbUnitOfWork(Clock, IdGenerator);
     RoleRepository     = new DbRoleRepository(UnitOfWork);
     AuthUserRepository = new DbAuthUserRepository(RoleRepository, UnitOfWork);
     UserRepository     = new DbUserRepository(UnitOfWork);
     GameRepository     = new DbGameRepository(UnitOfWork);
 }