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...

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

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

    hi

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

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    balessi75 created

    Thanks @maliming

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

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 28, 2026, 11:44
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.