Browse Source
Merge pull request #17005 from abpframework/liangshiwei/cli
Add ConnectionStringRenameStep
pull/17007/head
maliming
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
39 additions and
2 deletions
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ConnectionStringRenameStep.cs
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceServiceTemplateBase.cs
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs
|
|
|
@ -0,0 +1,21 @@ |
|
|
|
using System; |
|
|
|
using System.Linq; |
|
|
|
using Volo.Abp.Cli.ProjectBuilding.Files; |
|
|
|
|
|
|
|
namespace Volo.Abp.Cli.ProjectBuilding.Building; |
|
|
|
|
|
|
|
public class ConnectionStringRenameStep : ProjectBuildPipelineStep |
|
|
|
{ |
|
|
|
public override void Execute(ProjectBuildContext context) |
|
|
|
{ |
|
|
|
foreach (var fileEntry in context.Files.Where(file => file.Name.EndsWith(CliConsts.AppSettingsJsonFileName, StringComparison.OrdinalIgnoreCase))) |
|
|
|
{ |
|
|
|
RenameDatabaseName(fileEntry); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void RenameDatabaseName(FileEntry fileEntry) |
|
|
|
{ |
|
|
|
fileEntry.SetContent(fileEntry.Content.Replace("MyProjectNamePro", "MyProjectName")); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -645,6 +645,11 @@ public abstract class AppTemplateBase : TemplateInfo |
|
|
|
{ |
|
|
|
steps.Add(new ConnectionStringChangeStep()); |
|
|
|
} |
|
|
|
|
|
|
|
if (IsPro()) |
|
|
|
{ |
|
|
|
steps.Add(new ConnectionStringRenameStep()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected void CleanupFolderHierarchy(ProjectBuildContext context, List<ProjectBuildPipelineStep> steps) |
|
|
|
|
|
|
|
@ -39,7 +39,8 @@ public abstract class MicroserviceServiceTemplateBase : TemplateInfo |
|
|
|
SetRandomPortForHostProject(context, steps); |
|
|
|
RandomizeStringEncryption(context, steps); |
|
|
|
RandomizeAuthServerPassPhrase(context, steps); |
|
|
|
|
|
|
|
ChangeConnectionString(context, steps); |
|
|
|
|
|
|
|
return steps; |
|
|
|
} |
|
|
|
|
|
|
|
@ -75,4 +76,9 @@ public abstract class MicroserviceServiceTemplateBase : TemplateInfo |
|
|
|
{ |
|
|
|
steps.Add(new RandomizeAuthServerPassPhraseStep()); |
|
|
|
} |
|
|
|
|
|
|
|
private static void ChangeConnectionString(ProjectBuildContext context, List<ProjectBuildPipelineStep> steps) |
|
|
|
{ |
|
|
|
steps.Add(new ConnectionStringRenameStep()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -102,12 +102,17 @@ public abstract class ModuleTemplateBase : TemplateInfo |
|
|
|
steps.Add(new UpdateNuGetConfigStep("/NuGet.Config")); |
|
|
|
} |
|
|
|
|
|
|
|
private static void ChangeConnectionString(ProjectBuildContext context, List<ProjectBuildPipelineStep> steps) |
|
|
|
private void ChangeConnectionString(ProjectBuildContext context, List<ProjectBuildPipelineStep> steps) |
|
|
|
{ |
|
|
|
if (context.BuildArgs.ConnectionString != null) |
|
|
|
{ |
|
|
|
steps.Add(new ConnectionStringChangeStep()); |
|
|
|
} |
|
|
|
|
|
|
|
if (IsPro()) |
|
|
|
{ |
|
|
|
steps.Add(new ConnectionStringRenameStep()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void CleanupFolderHierarchy(ProjectBuildContext context, List<ProjectBuildPipelineStep> steps) |
|
|
|
|