diff --git a/products/ASC.Files/Core/Core/Thirdparty/ThirdPartyFileDao.cs b/products/ASC.Files/Core/Core/Thirdparty/ThirdPartyFileDao.cs index 392047f7a1..f6dd74d0f3 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/ThirdPartyFileDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/ThirdPartyFileDao.cs @@ -381,25 +381,10 @@ internal abstract class ThirdPartyFileDao : IFileDao : IFileDao> TagsAsync = + public static readonly Func> DeleteTagsAsync = Microsoft.EntityFrameworkCore.EF.CompileAsyncQuery( (FilesDbContext ctx) => - from ft in ctx.Tag - join ftl in ctx.TagLink.DefaultIfEmpty() on new { TenantId = ft.TenantId, Id = ft.Id } equals new - { - TenantId = ftl.TenantId, - Id = ftl.TagId - } - where ftl == null - select ft); + (from ft in ctx.Tag + join ftl in ctx.TagLink.DefaultIfEmpty() on new { TenantId = ft.TenantId, Id = ft.Id } equals new + { + TenantId = ftl.TenantId, + Id = ftl.TagId + } + where ftl == null + select ft) + .ExecuteDelete()); - public static readonly Func> TagLinksAsync = + public static readonly Func> DeleteTagLinksAsync = Microsoft.EntityFrameworkCore.EF.CompileAsyncQuery( (FilesDbContext ctx, int tenantId, string idStart) => ctx.TagLink @@ -710,9 +696,10 @@ static file class Queries .Where(r => ctx.ThirdpartyIdMapping .Where(t => t.TenantId == tenantId) .Where(t => t.Id.StartsWith(idStart)) - .Select(t => t.HashId).Any(h => h == r.EntryId))); + .Select(t => t.HashId).Any(h => h == r.EntryId)) + .ExecuteDelete()); - public static readonly Func> FilesSecuritiesAsync = + public static readonly Func> DeleteFilesSecuritiesAsync = Microsoft.EntityFrameworkCore.EF.CompileAsyncQuery( (FilesDbContext ctx, int tenantId, string idStart) => ctx.Security @@ -720,13 +707,15 @@ static file class Queries .Where(r => ctx.ThirdpartyIdMapping .Where(t => t.TenantId == tenantId) .Where(t => t.Id.StartsWith(idStart)) - .Select(t => t.HashId).Any(h => h == r.EntryId))); + .Select(t => t.HashId).Any(h => h == r.EntryId)) + .ExecuteDelete()); - public static readonly Func> - ThirdpartyIdMappingsAsync = + public static readonly Func> + DeleteThirdpartyIdMappingsAsync = Microsoft.EntityFrameworkCore.EF.CompileAsyncQuery( (FilesDbContext ctx, int tenantId, string idStart) => ctx.ThirdpartyIdMapping .Where(r => r.TenantId == tenantId) - .Where(t => t.Id.StartsWith(idStart))); + .Where(t => t.Id.StartsWith(idStart)) + .ExecuteDelete()); }