Open Closed

Tenant Domain Resolution The requested service 'Volo.Abp.TenantManagement.EntityFrameworkCore.TenantManagementDbContext' has not been registered. #7868


User avatar
0
TonyLewis created

Check the samples to s ee the basic tasks: https://abp.io/docs/latest/samples The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info: 🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration button.

  • ABP Framework version: v8.2.2
  • UI Type: MVC
  • Database System: EF Core (PostgreSQL)
  • Tiered (for MVC): yes
  • Exception message and full stack trace: The requested service 'Volo.Abp.TenantManagement.EntityFrameworkCore.TenantManagementDbContext' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency. See https://autofac.rtfd.io/help/service-not-registered for more info.
  • Steps to reproduce the issue:

This is an implementation of the Domain Tenant Resolution. We had this running with a community edition of the library. We implemented the commercial package and made the same modifications, but now it throws this error.

public class CustomTenantRepository : EfCoreRepository<TenantManagementDbContext, Tenant, Guid>, ICustomTenantRepository
{
    public CustomTenantRepository(IDbContextProvider<TenantManagementDbContext> dbContextProvider) : base(dbContextProvider)
    {
    }

    public async Task<Tenant> GetTenantByDomain(string host, CancellationToken cancellationToken = default)
    {
        var context = await GetDbContextAsync();
        var tenant = context.Tenants.Where(u => EF.Property<string>(u, "Domain") == host);
        return await tenant.FirstOrDefaultAsync(cancellationToken: cancellationToken);
    }
}

Is the DbContext different in the pro module?

I don't know what to check next.

Thanks, Tony Lewis


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    We use the SaasDbContext(Saas module) in the commercial version.

    The TenantManagementDbContext is free&opensource module.

    you should use the Saas module

    https://abp.io/modules/Volo.Saas https://abp.io/docs/commercial/latest/modules/saas

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11