Base solution for your next web application
Open Closed

Help on Query | Get All tenantIds where Edition Feature is Enabled/Avaible #9703


User avatar
0
ajayak created
  • What is your product version? 9.1
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .NET Core

How can I get all tenantIds where Edition Feature is Enabled/Avaible with 1 DB Query?

Similar to getting all settings in 1 query:

var settings = await _settingRepository.GetAll().IgnoreQueryFilters()
                .Where(c => c.TenantId.HasValue)
                .Where(c => c.Name == "MyName")
                .Select(c => new { TenantId = c.TenantId.Value, Value = c.Value.ToBool() })
                .ToListAsync();

3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi

    You can try to switch to the host side to query the tenant directly.

  • User Avatar
    0
    ajayak created

    @maliming, can you please share an example?

  • User Avatar
    0
    maliming created
    Support Team

    You can use the following three repository to query directly.

    private readonly IRepository<TTenant> _tenantRepository;
    private readonly IRepository<TenantFeatureSetting, long> _tenantFeatureRepository;
    private readonly IRepository<EditionFeatureSetting, long> _editionFeatureRepository;