Activities of "htavukcu"

I think I’ve found the root cause. Here’s my observation: In short, the GetDbContextAsync method determines which database connection to use based on the entity type that the repository is bound to. I misunderstood this behavior at first. In my setup, the detail entities don’t have a TenantId field, so the repositories created for those entities always operate on the host database.

Yes, I have a separate connection string for the tenant. I can see it in the TenantConnectionStrings table, and its name is Default. I’ll clear the Redis cache and try again.

It’s a bit difficult for me to prepare a minimal reproduction project at the moment. Are there any specific areas or configurations you would recommend me to check?

var _ = await dbContext.Set<xxx>() .AsNoTracking() .Where(x => x.Code == xxx) .SingleAsync();

Because it runs on the host database, it can’t find the record.

I’m not directly using that connection string, but the queries I run through the DbContext are executed on the host database. Should I avoid using it as well?

Hi,

In my multi-tenant application, when I assign a different database for a tenant and obtain a new DbContext instance using the GetDbContextAsync() method in repositories, the connection string always points to the host database instead of the tenant database. I don’t understand why this happens. Below are some details that might help clarify the situation — I’d appreciate your comments based on them.

MultiTenancy is enabled.

The entity implements the IMultiTenant interface.

dbContext.CurrentTenant has the correct value.

When I call tenantStore.FindAsync, the tenant configuration is returned correctly.

In the container, I can see that IConnectionStringResolver is registered as MultiTenantConnectionStringResolver.

var connectionStringName = ConnectionStringNameAttribute.GetConnStringName(typeof(xxxx)); → returns the correct value.

var connectionStringTry = await connectionStringResolver.ResolveAsync(); → returns the correct tenant connection string.

var isMultiTenant = EntityHelper.IsMultiTenant(typeof(xxxx)); → returns true.

var connectionString = dbContext.Database.GetConnectionString(); → returns the host database connection string, but it should be the tenant’s connection string.

What am I missing here? Could you please help me understand why this is happening?

var tenantStore = base.LazyServiceProvider
    .GetRequiredService<ITenantStore>();

// as expected    
var tenantConfig = await tenantStore.FindAsync(dbContext.CurrentTenant.Id.Value);

// as expected, type is MultiTenantConnectionStringResolver
var connectionStringResolver =
    base.LazyServiceProvider.GetRequiredService<IConnectionStringResolver>();

// as expected -> default
var connectionStringName = ConnectionStringNameAttribute.GetConnStringName(typeof(xxxContext));

// as expected
var connectionStringTry = await connectionStringResolver.ResolveAsync();

// as expected -> true
var ismultiTenant = EntityHelper.IsMultiTenant(typeof(xx));

// host db conenction 
var connectionString = dbContext.Database.GetConnectionString();

// wrong response because its runing on host db
// First, find the xxx (tenant filter is automatically applied here )
var _ = await dbContext.Set<xxx>()
    .AsNoTracking()
    .Where(x => x.Code == xxx)
    .SingleAsync();

It worked, thank you.

Hi,

No, I use Basic Theme

Can you share an example for method 2?

Hi team,

I'm using the MVC UI with Account.Pro module and I would like to customize the alert messages shown on the login page — particularly in cases like invalid credentials.

My questions are:

1-Is there a way to change the position and style of the default alert messages on the login page? 2-Alternatively, is it possible to handle these alerts on the client side, so I can show a custom message instead of the default one?

I'd appreciate any guidance or recommended approach for customizing this behavior within the context of the MVC UI and Account.Pro module.

Thanks in advance!

Showing 1 to 10 of 38 entries
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.1.0-preview. Updated on October 30, 2025, 06:33