diff --git a/server/Persistence/Seed/Seeder.cs b/server/Persistence/Seed/Seeder.cs index 501f5d3..a147267 100644 --- a/server/Persistence/Seed/Seeder.cs +++ b/server/Persistence/Seed/Seeder.cs @@ -6,24 +6,23 @@ namespace server.Persistence.Seed { public class Seeder { - private readonly IMongoClient _client; - private readonly IMongoDatabase _database; - private readonly IConfiguration _config; private readonly IMongoCollection _seasons; private readonly IMongoCollection _episodes; private readonly IMongoCollection _quotes; public Seeder() { - _config = new ConfigurationBuilder() + IConfiguration config = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); - _client = new MongoClient(_config.GetSection("MongoDBSettings:ConnectionString").Value); - _database = _client.GetDatabase(_config.GetSection("MongoDBSettings:DatabaseName").Value); - _seasons = _database.GetCollection(_config.GetSection("MongoDBSettings:SeasonsCollection").Value); - _episodes = _database.GetCollection(_config.GetSection("MongoDBSettings:EpisodesCollection").Value); - _quotes = _database.GetCollection(_config.GetSection("MongoDBSettings:QuotesCollection").Value); + IMongoClient client = new MongoClient(config.GetSection("MongoDBSettings:ConnectionString").Value); + + IMongoDatabase database = client.GetDatabase(config.GetSection("MongoDBSettings:DatabaseName").Value); + + _seasons = database.GetCollection(config.GetSection("MongoDBSettings:SeasonsCollection").Value); + _episodes = database.GetCollection(config.GetSection("MongoDBSettings:EpisodesCollection").Value); + _quotes = database.GetCollection(config.GetSection("MongoDBSettings:QuotesCollection").Value); } public async Task SeedSeasonsAsync()