mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
UnitOfWork compltely removed. GetDbContext now returns a NadekoContext. Changed every access to contect via uow._context to uow
This commit is contained in:
@@ -34,7 +34,7 @@ namespace NadekoBot.Modules.Games
|
||||
{
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
uow._context.GuildConfigs.SetCleverbotEnabled(ctx.Guild.Id, false);
|
||||
uow.GuildConfigs.SetCleverbotEnabled(ctx.Guild.Id, false);
|
||||
await uow.SaveChangesAsync();
|
||||
}
|
||||
await ReplyConfirmLocalizedAsync("cleverbot_disabled").ConfigureAwait(false);
|
||||
@@ -45,7 +45,7 @@ namespace NadekoBot.Modules.Games
|
||||
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
uow._context.GuildConfigs.SetCleverbotEnabled(ctx.Guild.Id, true);
|
||||
uow.GuildConfigs.SetCleverbotEnabled(ctx.Guild.Id, true);
|
||||
await uow.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
@@ -60,7 +60,7 @@ namespace NadekoBot.Modules.Games.Common
|
||||
finally { _locker.Release(); }
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var trackedPoll = uow._context.Poll.FirstOrDefault(x => x.Id == Poll.Id);
|
||||
var trackedPoll = uow.Poll.FirstOrDefault(x => x.Id == Poll.Id);
|
||||
trackedPoll.Votes.Add(voteObj);
|
||||
uow.SaveChanges();
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ namespace NadekoBot.Modules.Games.Services
|
||||
// public void EnsureMigrated()
|
||||
// {
|
||||
// using var uow = _db.GetDbContext();
|
||||
// using var conn = uow._context.Database.GetDbConnection();
|
||||
// using var conn = uow.Database.GetDbConnection();
|
||||
// MigrateRaceAnimals(conn);
|
||||
// MigrateEightBall(conn);
|
||||
// }
|
||||
|
@@ -33,7 +33,7 @@ namespace NadekoBot.Modules.Games.Services
|
||||
|
||||
using (var uow = db.GetDbContext())
|
||||
{
|
||||
ActivePolls = uow._context.Poll.GetAllPolls()
|
||||
ActivePolls = uow.Poll.GetAllPolls()
|
||||
.ToDictionary(x => x.GuildId, x =>
|
||||
{
|
||||
var pr = new PollRunner(db, x);
|
||||
@@ -72,7 +72,7 @@ namespace NadekoBot.Modules.Games.Services
|
||||
{
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
uow._context.Poll.Add(p);
|
||||
uow.Poll.Add(p);
|
||||
uow.SaveChanges();
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace NadekoBot.Modules.Games.Services
|
||||
pr.OnVoted -= Pr_OnVoted;
|
||||
|
||||
using var uow = _db.GetDbContext();
|
||||
uow._context.RemovePoll(pr.Poll.Id);
|
||||
uow.RemovePoll(pr.Poll.Id);
|
||||
uow.SaveChanges();
|
||||
|
||||
return pr.Poll;
|
||||
|
Reference in New Issue
Block a user