Open Closed

Customize TenantConfigurationProvider #7032


User avatar
0
lan.dang created
  • ABP Framework version: v8.1.0
  • UI Type: Angular
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hello, I take care project from Christope This solution works with ABP 7.0.0 https://support.abp.io/QA/Questions/1490/Adding-project-VoloAbpMultiTenancy-from-Github-into-ABP-solution But I got this error after upgrade ABP to 8.1.0 ArgumentException: The type 'Kwork.StaffApp.CustomSource.MyTenantConfigurationProvider' is not assignable to service 'Volo.Abp.Identity.IdentityUserManager'. How can I make it works? I tried to add but it does not solve the error context.Services.Replace( ServiceDescriptor.Transient<ITenantConfigurationProvider, MyTenantConfigurationProvider>() );


3 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can try this:

    [Volo.Abp.DependencyInjection.Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(TenantConfigurationProvider), typeof(ITenantConfigurationProvider))]
    public class MyTenantConfigurationProvider : TenantConfigurationProvider
    {
        public MyTenantConfigurationProvider(
            ITenantResolver tenantResolver,
            ITenantStore tenantStore, 
            ITenantResolveResultAccessor tenantResolveResultAccessor) : 
            base(tenantResolver, tenantStore, tenantResolveResultAccessor)
        {
        }
    
        public override async Task GetAsync(bool saveResolveResult = false)
        {
            return await Task.FromResult(new TenantConfiguration(Guid.Empty, "dummy"));
        }
    }
    
  • User Avatar
    0
    lan.dang created

    Thank you, it worked

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    : )

Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38