Skip to content

Tenant Management Module

The Tenant Management Module is designed to support multi-tenant management capabilities. Its main features include:

  • Tenant Management functionality provides data models and repositories for managing tenants.
  • Edition Management functionality manages different editions or plans that tenants can subscribe to.
  • Set features of editions and tenants.
  • Set connection string of tenants.

User Interface

This module provides MVC/Razor Pages UI.

This module adds an Tenant management menu item to the root menu:

menu

  • Tenants: Tenant management page.
  • Editions: Edition management page.

TenantManagementMenus class has the constants for the menu item names.

Features

This section covers some other features provided by this module.

Tenant management

Tenant page is used to manage tenants in the system.

You can create a new tenant or edit a tenant in this page:

tenant

Connection String

You can manage connection string of a tenant;

  • Use shared database option is useful for SaaS models where isolation at the database level is not required.

When enabled, the tenant’s data will be stored in a common database shared with other tenants, rather than in a dedicated or host-specific database.

  • Encrypt connection strings option is recommended for production environments to safeguard database access details.

When enabled, the connection string is stored and handled in an encrypted format, protecting sensitive information such as credentials.

  • Use host database option determines if the tenant should use the host (main application) database instead of a separate or shared database.

When enabled, the tenant’s data is stored in the same database as the host application, rather than in a tenant-specific or shared database. It is useful for small deployments or when tenant data does not require separation from host data.

connections

Module Specific Connection Strings

You can also use the module-specific database connection string feature.

To use this feature, you should configure the module-specific database in the ConfigureServices method of your module class. For example, the following code configures the TenantManagement module to use a separate database for each tenant.

Configure<AbpDbConnectionOptions>(options => 
{
    options.Databases.Configure("TenantManagement", database => 
    {
        database.IsUsedByTenants = true;
    });
});

specific-connection

Tenant Features

You can set features of tenants.

tenant

Edition management

Editions page is used to manage the editions in your system.

edition

Data seed

This module adds some initial data to the database when you run .DbMigrator if the IsUserSeedEnabled option is set:

  • Creates a Power System Simulation, Network Model Manager and Grid Model Builder editions.

Distributed Events

This module defines the following ETOs (Event Transfer Objects) to allow you to subscribe to changes on the entities of the module;

  • TenantEto is published on changes done on a Tenant entity.
  • EditionEto is published on changes done on an Edition entity.

Example: Get notified when a new tenant has been created

public class MyHandler :
    IDistributedEventHandler<EntityCreatedEto<TenantEto>>,
    ITransientDependency
{
    public async Task HandleEventAsync(EntityCreatedEto<TenantEto> eventData)
    {
        TenantEto tenant = eventData.Entity;
        // TODO: ...
    }
}