Starts in:
1 DAY
7 HRS
53 MIN
29 SEC
Starts in:
1 D
7 H
53 M
29 S
Open Closed

MultiTenantConnectionStringResolver override/replace issue #4790


User avatar
0
balessi75 created

ABP Commercial 7.0.1 / Blazor Server / EF / Non tiered / Seperated Host and Tenant DBs

Hi, as per the answer to... https://support.abp.io/QA/Questions/4703/Question-on-separate-databases-per-tenant

...we are attempting to override MultiTenantConnectionStringResolver

The problem is that the ResolveAsync method never gets hit in our overriden/replaced implementation when we set a brake point. Either we are not overriding/replacing the correct Abp class or there is a problem with the way we are attempting to override the resolver.

Our override/replace is defined as follows:

using Volo.Abp.MultiTenancy;

namespace FM.nVision.Saas;

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(MultiTenantConnectionStringResolver))]
public class MyMultiTenantConnectionStringResolver : MultiTenantConnectionStringResolver
{
    private readonly ICurrentTenant _currentTenant;

    public MyMultiTenantConnectionStringResolver(
        IOptionsMonitor<AbpDbConnectionOptions> options,
        ICurrentTenant currentTenant,
        IServiceProvider serviceProvider)
        : base(options, currentTenant, serviceProvider)
    {
        _currentTenant = currentTenant;

    }

    public override async Task<string> ResolveAsync(string connectionStringName = null)
    {

        return await base.ResolveAsync(connectionStringName);
    }
}

We are attempting to decrypt the connection string from the database when the framework is reading it.

Please advise and thanks in advance...


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

    hi

    [ExposeServices(typeof(MultiTenantConnectionStringResolver), typeof(IConnectionStringResolver))]

  • User Avatar
    0
    balessi75 created

    Thanks @maliming

    Now I know to check base class interfaces and included them in the [ExposeServices] attribute.

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