0
zhongfang created
I found this attribute in TenantManagementDbContext. I want to use this function, ignore TenantId in a single query, not whole DbContext, How to do?
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.TenantManagement.EntityFrameworkCore;
[IgnoreMultiTenancy]
[ConnectionStringName(AbpTenantManagementDbProperties.ConnectionStringName)]
public class TenantManagementDbContext : AbpDbContext<TenantManagementDbContext>, ITenantManagementDbContext
{
1 Answer(s)
-
0
private readonly IRepository<Product, Guid> _productRepository; private readonly IDataFilter _dataFilter; public ProductManager( IRepository<Product, Guid> productRepository, IDataFilter dataFilter) { _productRepository = productRepository; _dataFilter = dataFilter; } public async Task<long> GetProductCountAsync() { using (_dataFilter.Disable<IMultiTenant>()) { return await _productRepository.GetCountAsync(); } }