public static async Task SavePubgMatch(Match match) { using (var con = new PubgDB()) { var matchInDb = await con.Matches.FirstOrDefaultAsync(m => m.Id == match.Id); if (matchInDb == null) { con.Matches.Add(match); await con.SaveChangesAsync(); } } }
public Configure() { PubgApiConfiguration.Configure(opt => { opt.ApiKey = Config.PubgToken; }); using (var con = new PubgDB()) { if (!con.Database.GetService <IRelationalDatabaseCreator>().Exists()) { // Create the Db if it doesn't exist and applies any pending migration. con.Database.Migrate(); } } }