Пример #1
0
 public GameController(IGamesRepository gamesRepo, IPlayersRepository playersRepo, IChatRepository chatRepo, IGoTStorage storage)
 {
     gamesRepository   = gamesRepo;
     playersRepository = playersRepo;
     chatRepository    = chatRepo;
     this.storage      = storage;
 }
        public static IApplicationBuilder UseGoTStorage(this IApplicationBuilder app)
        {
            IGoTStorage      storage = app.ApplicationServices.GetRequiredService <IGoTStorage>();
            GoTGameContextDb context = app.ApplicationServices.GetRequiredService <GoTGameContextDb>();

            var games = context.Games.ToList();

            foreach (Game game in games)
            {
                var playerIds = context.Players.Where(p => p.GameId == game.Id).Select(p => p.Id).ToArray();
                storage.CreateGameStorage(game.Id, playerIds);
            }

            return(app);
        }
Пример #3
0
 public ChatRepository(GoTGameContextDb context, IGoTStorage storage, IPlayersRepository playersRepository)
     : base(context, storage)
 {
     gameChats = new List <GameChat>();
     this.playersRepository = playersRepository;
 }
Пример #4
0
 public PlayersRepository(GoTGameContextDb context, IGoTStorage storage, IGamesRepository gamesRepo)
     : base(context, storage)
 {
     gamesRepository = gamesRepo;
 }
Пример #5
0
 public BaseRepository(GoTGameContextDb context, IGoTStorage storage)
 {
     this.context = context;
     this.storage = storage;
 }
Пример #6
0
 public ChatController(IChatRepository chatRepo, IGoTStorage storage)
 {
     chatRepository = chatRepo;
     this.storage   = storage;
 }