diff --git a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Application/LINGYUN/Abp/BlobManagement/Integration/BlobIntegrationService.cs b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Application/LINGYUN/Abp/BlobManagement/Integration/BlobIntegrationService.cs index b031ec92c..24d24b483 100644 --- a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Application/LINGYUN/Abp/BlobManagement/Integration/BlobIntegrationService.cs +++ b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Application/LINGYUN/Abp/BlobManagement/Integration/BlobIntegrationService.cs @@ -83,7 +83,8 @@ public class BlobIntegrationService : BlobAppServiceBase, IBlobIntegrationServic try { var blobName = HttpUtility.UrlDecode(input.BlobName); - return await BlobRepository.ExistsAsync(input.ContainerName, blobName); + var blobContainer = await BlobContainerRepository.GetByNameAsync(BlobManager.GetBlobProvider(), input.ContainerName); + return await BlobRepository.ExistsAsync(blobName, blobContainer.Id); } catch (Exception ex) { diff --git a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain/LINGYUN/Abp/BlobManagement/IBlobRepository.cs b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain/LINGYUN/Abp/BlobManagement/IBlobRepository.cs index 1577bb3f2..6b011126e 100644 --- a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain/LINGYUN/Abp/BlobManagement/IBlobRepository.cs +++ b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain/LINGYUN/Abp/BlobManagement/IBlobRepository.cs @@ -10,8 +10,8 @@ namespace LINGYUN.Abp.BlobManagement; public interface IBlobRepository : IBasicRepository { Task ExistsAsync( - string containerName, string fullName, + Guid? containerId = null, CancellationToken cancellationToken = default); Task FindByNameAsync( diff --git a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.EntityFrameworkCore/LINGYUN/Abp/BlobManagement/EntityFrameworkCore/EfCoreBlobRepository.cs b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.EntityFrameworkCore/LINGYUN/Abp/BlobManagement/EntityFrameworkCore/EfCoreBlobRepository.cs index 1456a02e4..b54246385 100644 --- a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.EntityFrameworkCore/LINGYUN/Abp/BlobManagement/EntityFrameworkCore/EfCoreBlobRepository.cs +++ b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.EntityFrameworkCore/LINGYUN/Abp/BlobManagement/EntityFrameworkCore/EfCoreBlobRepository.cs @@ -20,17 +20,13 @@ public class EfCoreBlobRepository : EfCoreRepository ExistsAsync( - string containerName, string fullName, + Guid? containerId = null, CancellationToken cancellationToken = default) { - var dbContext = await GetDbContextAsync(); - - return await (from container in dbContext.Set() - join blob in dbContext.Set() - on container.Id equals blob.ContainerId - where container.Name == containerName && blob.FullName == fullName - select blob) + return await (await GetQueryableAsync()) + .Where(x => x.FullName == fullName) + .WhereIf(containerId.HasValue, x => x.ContainerId == containerId) .AnyAsync(GetCancellationToken(cancellationToken)); }