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); }
public ChatRepository(GoTGameContextDb context, IGoTStorage storage, IPlayersRepository playersRepository) : base(context, storage) { gameChats = new List <GameChat>(); this.playersRepository = playersRepository; }
public PlayersRepository(GoTGameContextDb context, IGoTStorage storage, IGamesRepository gamesRepo) : base(context, storage) { gamesRepository = gamesRepo; }
public BaseRepository(GoTGameContextDb context, IGoTStorage storage) { this.context = context; this.storage = storage; }
public ChatController(IChatRepository chatRepo, IGoTStorage storage) { chatRepository = chatRepo; this.storage = storage; }