-
Notifications
You must be signed in to change notification settings - Fork 164
Managing sharding databases
Jon P Smith edited this page Apr 25, 2022
·
15 revisions
The AuthP library has a AuthPermissions.SupportCode project which contains a service called AccessDatabaseInformation. This can be used to alter the list of database information in the shardingsettings.json file.
This provides methods to:
-
ReadShardingSettingsFile- read theshardingsettings.jsonfile - useful for showing all the content of the file. -
GetDatabaseInformationByName(name)- read a specific database information. Used when editing / deleting an entry. -
AddDatabaseInfoToJsonFile(info)- Adds a new database information to theshardingsettings.jsonfile. -
UpdateDatabaseInfoToJsonFile(info)- Updates the database information with the givenName. -
RemoveDatabaseInfoToJsonFileAsync(name)- Removes the database information with the givenName.
This is designed to work with both development and production.
NOTE: You need to manually register this service as its not part of the AuthP setup. See this code from the application's Program class.
//manually add services from the AuthPermissions.SupportCode project
builder.Services.AddTransient<IAccessDatabaseInformation, AccessDatabaseInformation>();You can see the AccessDatabaseInformation running in the Example6.MvcWebApp.Sharding web application. Log in as an application admin user and click the Auth Admin -> List database info. See the screenshot below:

The code can be found in the ShardingController class.
- Intro to multi-tenants (ASP.NET video)
- Articles in date order:
- 0. Improved Roles/Permissions
- 1. Setting up the database
- 2. Admin: adding users and tenants
- 3. Versioning your app
- 4. Hierarchical multi-tenant
- 5. Advanced technique with claims
- 6. Sharding multi-tenant setup
- 7. Three ways to add new users
- 8. The design of the sharding data
- 9. Down for maintenance article
- 10: Three ways to refresh claims
- 11. Features of Multilingual service
- 12. Custom databases - Part1
- Videos (old)
- Authentication explained
- Permissions explained
- Roles explained
- AuthUser explained
- Multi tenant explained
- Sharding explained
- How AuthP handles sharding
- How AuthP handles errors
- Languages & cultures explained
- JWT Token refresh explained
- Setup Permissions
- Setup Authentication
- Startup code
- Setup the custom database feature
- JWT Token configuration
- Multi tenant configuration
- Using Permissions
- Using JWT Tokens
- Creating a multi-tenant app
- Supporting multiple languages
- Unit Test your AuthP app