Skip to content

Improvement to ShardingConnections.GetDatabaseInfoNamesWithTenantNamesAsync method #39

Closed
@JonPSmith

Description

@JonPSmith

The GetDatabaseInfoNamesWithTenantNamesAsync method returns a list of the names of the databases found in the shardingsettings.json file, with information on what tenants are in each database. This is useful when a tenant is created or moved as you need to select a database to hold the new tenant.

In version 3.2.0 of this library the GetDatabaseInfoNamesWithTenantNamesAsync method returned a list where each entry contains:

  • The database information name
  • A list of tenant name(s) stored in the database linked to the database information name

In version 3.3.0 of this library the GetDatabaseInfoNamesWithTenantNamesAsync method a third part is provided, which means the returned information is

  • The database information name
  • A bool? value called HasOwnDb, which provides a value that tells you:
    • null: The database is empty
    • true: There is one sharding tenant in this database
    • false: The database contains tenants that can shares a database - see NOTE1
  • A list of tenant name(s) stored in the database linked to the database information name

NOTE1: If database information name matches the ShardingDefaultDatabaseInfoName held in the AuthPermissionsOptions (default value = "Default Database") then even if there no tenants the HasOwnDb will be false, as that database contains the AuthP data, so its not applicable for sharding tenants.

This extra data is useful for a admin user, but the real reason of this change is because of the new GetDatabaseForNewTenant service / method that can automatically select a database for a new tenant.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions