mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 17:58: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:
@@ -31,7 +31,7 @@ namespace NadekoBot.Modules.Permissions
|
||||
{
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var config = uow._context.GcWithPermissionsv2For(ctx.Guild.Id);
|
||||
var config = uow.GcWithPermissionsv2For(ctx.Guild.Id);
|
||||
if (action == null) action = new PermissionAction(!config.VerbosePermissions); // New behaviour, can toggle.
|
||||
config.VerbosePermissions = action.Value;
|
||||
await uow.SaveChangesAsync();
|
||||
@@ -73,7 +73,7 @@ namespace NadekoBot.Modules.Permissions
|
||||
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var config = uow._context.GcWithPermissionsv2For(ctx.Guild.Id);
|
||||
var config = uow.GcWithPermissionsv2For(ctx.Guild.Id);
|
||||
config.PermissionRole = role.Id.ToString();
|
||||
uow.SaveChanges();
|
||||
_service.UpdateCache(config);
|
||||
@@ -92,7 +92,7 @@ namespace NadekoBot.Modules.Permissions
|
||||
{
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var config = uow._context.GcWithPermissionsv2For(ctx.Guild.Id);
|
||||
var config = uow.GcWithPermissionsv2For(ctx.Guild.Id);
|
||||
config.PermissionRole = null;
|
||||
await uow.SaveChangesAsync();
|
||||
_service.UpdateCache(config);
|
||||
@@ -148,11 +148,11 @@ namespace NadekoBot.Modules.Permissions
|
||||
Permissionv2 p;
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var config = uow._context.GcWithPermissionsv2For(ctx.Guild.Id);
|
||||
var config = uow.GcWithPermissionsv2For(ctx.Guild.Id);
|
||||
var permsCol = new PermissionsCollection<Permissionv2>(config.Permissions);
|
||||
p = permsCol[index];
|
||||
permsCol.RemoveAt(index);
|
||||
uow._context.Remove(p);
|
||||
uow.Remove(p);
|
||||
await uow.SaveChangesAsync();
|
||||
_service.UpdateCache(config);
|
||||
}
|
||||
@@ -179,7 +179,7 @@ namespace NadekoBot.Modules.Permissions
|
||||
Permissionv2 fromPerm;
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
var config = uow._context.GcWithPermissionsv2For(ctx.Guild.Id);
|
||||
var config = uow.GcWithPermissionsv2For(ctx.Guild.Id);
|
||||
var permsCol = new PermissionsCollection<Permissionv2>(config.Permissions);
|
||||
|
||||
var fromFound = from < permsCol.Count;
|
||||
|
Reference in New Issue
Block a user