Base solution for your next web application
Open Closed

How to get connection string by Tenant ID ? #8092


User avatar
0
xitix created

Select * from AbpTenants where Id = 5

I want to get and use connection string in EntityFramework repository class from AbpTenant table from database.

NEED SAMPLE CODE


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

    Tenant entities have a ConnectionString property.

    var tenant = TenantManager.GetById(id);
    //var tenant = _tenantRepository.FirstOrDefault(x => x.Id == id);
    
    var connectionString = tenant.ConnectionString;
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because it has not had recent activity for a long time.