File tree Expand file tree Collapse file tree 4 files changed +19
-2
lines changed
AbpCompanyName.AbpProjectName.Application/MultiTenancy
AbpCompanyName.AbpProjectName.EntityFramework
Tools/AbpCompanyName.AbpProjectName.Migrator Expand file tree Collapse file tree 4 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 44using Abp . Application . Services . Dto ;
55using Abp . Authorization ;
66using Abp . AutoMapper ;
7- using Abp . Domain . Uow ;
7+ using Abp . Extensions ;
88using Abp . MultiTenancy ;
9+ using Abp . Runtime . Security ;
910using AbpCompanyName . AbpProjectName . Authorization ;
1011using AbpCompanyName . AbpProjectName . Authorization . Roles ;
1112using AbpCompanyName . AbpProjectName . Editions ;
@@ -48,6 +49,10 @@ public async Task CreateTenant(CreateTenantInput input)
4849 {
4950 //Create tenant
5051 var tenant = input . MapTo < Tenant > ( ) ;
52+ tenant . ConnectionString = input . ConnectionString . IsNullOrEmpty ( )
53+ ? null
54+ : SimpleStringCipher . Instance . Encrypt ( input . ConnectionString ) ;
55+
5156 var defaultEdition = await _editionManager . FindByNameAsync ( EditionManager . DefaultEditionName ) ;
5257 if ( defaultEdition != null )
5358 {
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ public class AbpProjectNameDataModule : AbpModule
1111 {
1212 public override void PreInitialize ( )
1313 {
14+ Database . SetInitializer ( new CreateDatabaseIfNotExists < AbpProjectNameDbContext > ( ) ) ;
15+
1416 Configuration . DefaultNameOrConnectionString = "Default" ;
1517 }
1618
Original file line number Diff line number Diff line change 1+ using System . Data . Entity ;
12using System . Reflection ;
23using Abp . Modules ;
4+ using AbpCompanyName . AbpProjectName . EntityFramework ;
35
46namespace AbpCompanyName . AbpProjectName . Migrator
57{
68 [ DependsOn ( typeof ( AbpProjectNameDataModule ) ) ]
79 public class AbpProjectNameMigratorModule : AbpModule
810 {
11+ public override void PreInitialize ( )
12+ {
13+ Database . SetInitializer < AbpProjectNameDbContext > ( null ) ;
14+
15+ Configuration . BackgroundJobs . IsJobExecutionEnabled = false ;
16+ }
17+
918 public override void Initialize ( )
1019 {
1120 IocManager . RegisterAssemblyByConvention ( Assembly . GetExecutingAssembly ( ) ) ;
Original file line number Diff line number Diff line change 55using Abp . Domain . Repositories ;
66using Abp . Extensions ;
77using Abp . MultiTenancy ;
8+ using Abp . Runtime . Security ;
89using AbpCompanyName . AbpProjectName . MultiTenancy ;
910
1011namespace AbpCompanyName . AbpProjectName . Migrator
@@ -74,7 +75,7 @@ public void Run(bool skipConnVerification)
7475 Log . Write ( "Name : " + tenant . Name ) ;
7576 Log . Write ( "TenancyName : " + tenant . TenancyName ) ;
7677 Log . Write ( "Tenant Id : " + tenant . Id ) ;
77- Log . Write ( "Connection string : " + tenant . ConnectionString ) ;
78+ Log . Write ( "Connection string : " + SimpleStringCipher . Instance . Decrypt ( tenant . ConnectionString ) ) ;
7879
7980 if ( ! migratedDatabases . Contains ( tenant . ConnectionString ) )
8081 {
You can’t perform that action at this time.
0 commit comments