public async Task AddLogThreadSafe(Log log) { var optionsBuilder = new DbContextOptionsBuilder <BattleSimulatorDbContext>(); optionsBuilder.UseSqlServer(DbContext.Database.GetDbConnection().ConnectionString); using (var context = new BattleSimulatorDbContext(optionsBuilder.Options)) { context.Add(log); await context.SaveChangesAsync(); } }
public async Task SaveChanges() { await _dbContext.SaveChangesAsync(); }