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();
            }
        }
示例#2
0
 public async Task SaveChanges()
 {
     await _dbContext.SaveChangesAsync();
 }