UnitOfWork compltely removed. GetDbContext now returns a NadekoContext. Changed every access to contect via uow._context to uow

This commit is contained in:
Kwoth
2021-06-19 05:16:27 +02:00
parent 51a4499809
commit c127dcd1e3
81 changed files with 404 additions and 512 deletions

View File

@@ -35,7 +35,7 @@ namespace NadekoBot.Modules.Permissions.Services
using (var uow = _db.GetDbContext())
{
foreach (var x in uow._context.GuildConfigs.Permissionsv2ForAll(client.Guilds.ToArray().Select(x => x.Id).ToList()))
foreach (var x in uow.GuildConfigs.Permissionsv2ForAll(client.Guilds.ToArray().Select(x => x.Id).ToList()))
{
Cache.TryAdd(x.GuildId, new PermissionCache()
{
@@ -53,7 +53,7 @@ namespace NadekoBot.Modules.Permissions.Services
{
using (var uow = _db.GetDbContext())
{
var config = uow._context.GuildConfigsForId(guildId,
var config = uow.GuildConfigsForId(guildId,
set => set.Include(x => x.Permissions));
UpdateCache(config);
}
@@ -68,7 +68,7 @@ namespace NadekoBot.Modules.Permissions.Services
{
using (var uow = _db.GetDbContext())
{
var config = uow._context.GcWithPermissionsv2For(guildId);
var config = uow.GcWithPermissionsv2For(guildId);
//var orderedPerms = new PermissionsCollection<Permissionv2>(config.Permissions);
var max = config.Permissions.Max(x => x.Index); //have to set its index to be the highest
foreach (var perm in perms)
@@ -175,7 +175,7 @@ namespace NadekoBot.Modules.Permissions.Services
{
using (var uow = _db.GetDbContext())
{
var config = uow._context.GcWithPermissionsv2For(guildId);
var config = uow.GcWithPermissionsv2For(guildId);
config.Permissions = Permissionv2.GetDefaultPermlist;
await uow.SaveChangesAsync();
UpdateCache(config);