/// <summary> /// Initializes a new instance of GeneratorService /// </summary> /// <param name="settings"></param> /// <param name="tableService"></param> public GeneratorService(ICoalDatabaseSettings settings, ITableService tableService, IMatchService matchService) { this.ConnectToDb(settings); this.settings = settings; this.tableService = tableService; this.matchService = matchService; }
/// <summary> /// Connects to the selected saveGame database. /// </summary> /// <param name="settings"></param> private void ConnectToDb(ICoalDatabaseSettings settings) { MongoClient client = new MongoClient(settings.ConnectionString); this.database = client.GetDatabase(settings.DatabaseName); this.teams = database.GetCollection <Team>(settings.TeamsCollectionName); }
/// <summary> /// Connects to the currently loaded DB. /// </summary> /// <param name="settings"></param> private void ConnectToDb(ICoalDatabaseSettings settings) { MongoClient client = new MongoClient(settings.ConnectionString); IMongoDatabase database = client.GetDatabase(settings.DatabaseName); this.players = database.GetCollection <Player>(settings.PlayersCollectionName); this.clubs = database.GetCollection <Club>(settings.ClubsCollectionName); }
private void ConnectToDb(ICoalDatabaseSettings settings) { MongoClient client = new MongoClient(settings.ConnectionString); this.database = client.GetDatabase(settings.DatabaseName); this.competitions = database.GetCollection <Competition>(settings.CompetitionsCollectionName); this.clubs = database.GetCollection <Club>(settings.ClubsCollectionName); }
private void ConnectToDb(ICoalDatabaseSettings settings) { MongoClient client = new MongoClient(settings.ConnectionString); this.database = client.GetDatabase(settings.DatabaseName); this.matches = this.database.GetCollection <Match>(settings.MatchesCollectionName); this.tables = this.database.GetCollection <Table>(settings.TablesCollectionName); }
/// <summary> /// Establishes a connection to the database /// </summary> /// <param name="settings"></param> private void ConnectToDb(ICoalDatabaseSettings settings) { MongoClient client = new MongoClient(settings.ConnectionString); this.database = client.GetDatabase(settings.DatabaseName); this.competitions = database.GetCollection <Competition>(settings.CompetitionsCollectionName); this.players = database.GetCollection <Player>(settings.PlayersCollectionName); this.clubs = database.GetCollection <Club>(settings.ClubsCollectionName); this.teams = database.GetCollection <Team>(settings.TeamsCollectionName); this.contracts = database.GetCollection <Contract>(settings.ContractsCollectionName); }
public SaveGameService(ICoalDatabaseSettings settings, IGeneratorService generatorService, ITableService tableService, ICompetitionService competitionService, IClubService clubService, ITeamService teamService, IMatchService matchService, IPlayerService playerService) { MongoClient client = new MongoClient(settings.ConnectionString); this.mainDatabase = client.GetDatabase(settings.MainDatabase); this.saveGames = this.mainDatabase.GetCollection <SaveGame>(settings.SaveGamesCollectionName); this.settings = settings; this.generatorService = generatorService; this.tableService = tableService; this.competitionService = competitionService; this.clubService = clubService; this.teamService = teamService; this.matchService = matchService; this.playerService = playerService; }
public TeamService(ICoalDatabaseSettings settings) { this.ConnectToDb(settings); this.settings = settings; }
public CompetitionService(ICoalDatabaseSettings settings) { this.ConnectToDb(settings); this.settings = settings; }