diff --git a/common/ASC.Core.Common/Data/DbLoginEventsManager.cs b/common/ASC.Core.Common/Data/DbLoginEventsManager.cs index 74c41825e5..e5513cbe4f 100644 --- a/common/ASC.Core.Common/Data/DbLoginEventsManager.cs +++ b/common/ASC.Core.Common/Data/DbLoginEventsManager.cs @@ -66,8 +66,8 @@ public class DbLoginEventsManager if (id < 0) return null; using var loginEventContext = _dbContextFactory.CreateDbContext(); - - return await Queries.FindLoginEventAsync(loginEventContext, id); + + return await loginEventContext.LoginEvents.FindAsync(id); } public async Task> GetLoginEventsAsync(int tenantId, Guid userId) @@ -135,10 +135,6 @@ public class DbLoginEventsManager file static class Queries { - public static readonly Func> FindLoginEventAsync = Microsoft.EntityFrameworkCore.EF.CompileAsyncQuery( - (MessagesContext ctx, int id) => - ctx.LoginEvents.Find(id)); - public static readonly Func, DateTime, IAsyncEnumerable> GetLoginEventsAsync = Microsoft.EntityFrameworkCore.EF.CompileAsyncQuery( (MessagesContext ctx, int tenantId, Guid userId, IEnumerable loginActions, DateTime date) => ctx.LoginEvents diff --git a/common/ASC.Core.Common/Data/DbQuotaService.cs b/common/ASC.Core.Common/Data/DbQuotaService.cs index 5ab51d5d4d..8beebb3991 100644 --- a/common/ASC.Core.Common/Data/DbQuotaService.cs +++ b/common/ASC.Core.Common/Data/DbQuotaService.cs @@ -87,7 +87,7 @@ class DbQuotaService : IQuotaService var dbTenantQuotaRow = _mapper.Map(row); dbTenantQuotaRow.UserId = row.UserId; - var exist = await Queries.FindQuotaRowAsync(coreDbContext, dbTenantQuotaRow.Tenant, dbTenantQuotaRow.UserId, dbTenantQuotaRow.Path); + var exist = await coreDbContext.QuotaRows.FindAsync(new object[] { dbTenantQuotaRow.Tenant, dbTenantQuotaRow.UserId, dbTenantQuotaRow.Path }); if (exist == null) { @@ -135,11 +135,6 @@ file static class Queries .Where(r => r.Tenant == tenantId) .SingleOrDefault()); - public static readonly Func> FindQuotaRowAsync = Microsoft.EntityFrameworkCore.EF.CompileAsyncQuery( - (CoreDbContext ctx, int tenantId, Guid userId, string path) => - ctx.QuotaRows - .Find(new object[] { tenantId, userId, path })); - public static readonly Func> UpdateCounterAsync = Microsoft.EntityFrameworkCore.EF.CompileAsyncQuery( (CoreDbContext ctx, int tenantId, Guid userId, string path, long counter) => ctx.QuotaRows diff --git a/common/ASC.Data.Backup.Core/Storage/BackupRepository.cs b/common/ASC.Data.Backup.Core/Storage/BackupRepository.cs index aae8fdd0d8..72c7334b7a 100644 --- a/common/ASC.Data.Backup.Core/Storage/BackupRepository.cs +++ b/common/ASC.Data.Backup.Core/Storage/BackupRepository.cs @@ -48,7 +48,7 @@ public class BackupRepository : IBackupRepository public async Task GetBackupRecordAsync(Guid id) { using var backupContext = _dbContextFactory.CreateDbContext(); - return await Queries.FindBackupAsync(backupContext, id); + return await backupContext.Backups.FindAsync(id); } public async Task GetBackupRecordAsync(string hash, int tenant) @@ -96,7 +96,7 @@ public class BackupRepository : IBackupRepository { using var backupContext = _dbContextFactory.CreateDbContext(); - var backup = await Queries.FindBackupAsync(backupContext ,id); + var backup = await backupContext.Backups.FindAsync(id); if (backup != null) { @@ -133,9 +133,6 @@ public class BackupRepository : IBackupRepository file static class Queries { - public static readonly Func> FindBackupAsync = Microsoft.EntityFrameworkCore.EF.CompileAsyncQuery( - (BackupsContext ctx, Guid id) => - ctx.Backups.Find(id)); public static readonly Func> GetBackupAsync = Microsoft.EntityFrameworkCore.EF.CompileAsyncQuery( (BackupsContext ctx, int tenantId, string hash) =>