diff --git a/products/ASC.Files/Core/Core/Dao/TeamlabDao/TagDao.cs b/products/ASC.Files/Core/Core/Dao/TeamlabDao/TagDao.cs index a31152c750..167dffb989 100644 --- a/products/ASC.Files/Core/Core/Dao/TeamlabDao/TagDao.cs +++ b/products/ASC.Files/Core/Core/Dao/TeamlabDao/TagDao.cs @@ -217,7 +217,7 @@ await strategy.ExecuteAsync(async () => continue; } - var id = await internalFilesDbContext.TagIdAsync(t.Owner, t.Name, t.Type); + var id = await internalFilesDbContext.TagIdAsync(t.Owner, t.Name, t.Type, tenantId); var toAdd = new DbFilesTag { @@ -312,7 +312,7 @@ private async Task SaveTagAsync(FilesDbContext filesDbContext, int tenantId if (!cacheTagId.TryGetValue(cacheTagIdKey, out var id)) { - id = await filesDbContext.TagIdAsync(t.Owner, t.Name, t.Type); + id = await filesDbContext.TagIdAsync(t.Owner, t.Name, t.Type, tenantId); if (id == 0) { diff --git a/products/ASC.Files/Core/Core/EF/Queries/TagQueries.cs b/products/ASC.Files/Core/Core/EF/Queries/TagQueries.cs index 7ddc05cefa..66051e916d 100644 --- a/products/ASC.Files/Core/Core/EF/Queries/TagQueries.cs +++ b/products/ASC.Files/Core/Core/EF/Queries/TagQueries.cs @@ -142,10 +142,10 @@ public Task DeleteTagAsync() return TagQueries.DeleteTagAsync(this); } - [PreCompileQuery([PreCompileQuery.DefaultGuid, null, TagType.Custom])] - public Task TagIdAsync(Guid owner, string name, TagType type) + [PreCompileQuery([PreCompileQuery.DefaultGuid, null, TagType.Custom, PreCompileQuery.DefaultInt])] + public Task TagIdAsync(Guid owner, string name, TagType type, int tenantId) { - return TagQueries.TagIdAsync(this, owner, name, type); + return TagQueries.TagIdAsync(this, owner, name, type, tenantId); } [PreCompileQuery([PreCompileQuery.DefaultInt, PreCompileQuery.DefaultInt, FileEntryType.File, null, PreCompileQuery.DefaultGuid, PreCompileQuery.DefaultDateTime, PreCompileQuery.DefaultInt])] @@ -486,10 +486,11 @@ static file class TagQueries where ftl == null select ft).ExecuteDelete()); - public static readonly Func> TagIdAsync = + public static readonly Func> TagIdAsync = Microsoft.EntityFrameworkCore.EF.CompileAsyncQuery( - (FilesDbContext ctx, Guid owner, string name, TagType type) => + (FilesDbContext ctx, Guid owner, string name, TagType type, int tenantId) => ctx.Tag + .Where(r => r.TenantId == tenantId) .Where(r => r.Owner == owner) .Where(r => r.Name == name) .Where(r => r.Type == type)