How is it possible to create a new tenant using current form and setting the default connection string programmatically, so as to not expose this information externally? One example could be to use the tenant's name and append it to the current database name. Is this easily doable without re-writing the code for SaaS?
Thank you.
- ABP Framework version: v7.3.3
- UI Type: Angular
- Database System: EF Core (PostgreSQL)
- Tiered (for MVC) or Auth Server Separated (for Angular): no
3 Answer(s)
-
0
hi
You have to do this manually. This is no built-in way.
You can download the saas module source code to check the logic.
Please feel free to add your comments. Thanks
-
0
Is it possible to override an AppService and modify its logic without rewriting the entire module? This way, there's no need to modify the form, but all the work can be done on the backend Thank you.
-
0
Is it possible to override an AppService and modify its logic without rewriting the entire module?
Yes, of course you can, for example:
[ExposeServices(typeof(ITenantAppService))] [Dependency(ReplaceServices = true)] public class MyTenantAppService : TenantAppService { public MyTenantAppService(ITenantRepository tenantRepository, IEditionRepository editionRepository, ITenantManager tenantManager, IDataSeeder dataSeeder, IDistributedEventBus distributedEventBus, IOptions<AbpDbConnectionOptions> dbConnectionOptions, IConnectionStringChecker connectionStringChecker) : base(tenantRepository, editionRepository, tenantManager, dataSeeder, distributedEventBus, dbConnectionOptions, connectionStringChecker) { } public override Task<SaasTenantDto> CreateAsync(SaasTenantCreateDto input) { input.ConnectionStrings = new SaasTenantConnectionStringsDto { Databases = new List<SaasTenantDatabaseConnectionStringsDto> { new SaasTenantDatabaseConnectionStringsDto { ConnectionString = "...", DatabaseName = "Default" } } }; return base.CreateAsync(input); } }