From 180016a6ea2639e8d8793b2738a87c461b07f761 Mon Sep 17 00:00:00 2001 From: David Kallesen Date: Tue, 13 Aug 2024 14:43:42 +0200 Subject: [PATCH 1/2] fix: add missing using statement to domainProjectName --- .../ProjectGenerator/ServerHostGenerator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerHostGenerator.cs b/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerHostGenerator.cs index b49b9ada..7796df9c 100644 --- a/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerHostGenerator.cs +++ b/src/Atc.Rest.ApiGenerator.Framework.Minimal/ProjectGenerator/ServerHostGenerator.cs @@ -290,7 +290,8 @@ public void MaintainGlobalUsings( $"{projectName}.Extensions", $"{projectName}.Generated", $"{projectName}.Options", - $"{projectName}".Replace(".Api", ".Domain", StringComparison.Ordinal), + domainProjectName, + $"{domainProjectName}.Extensions", }; GlobalUsingsHelper.CreateOrUpdate( From 0da635ea398a62956cf99a260bc78e65b5635f55 Mon Sep 17 00:00:00 2001 From: David Kallesen Date: Tue, 13 Aug 2024 15:00:34 +0200 Subject: [PATCH 2/2] chore: use char instead of string in replace --- src/Atc.Rest.ApiGenerator/Helpers/GenerateHelper.cs | 4 ++-- src/Atc.Rest.ApiGenerator/Models/BaseProjectOptions.cs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Atc.Rest.ApiGenerator/Helpers/GenerateHelper.cs b/src/Atc.Rest.ApiGenerator/Helpers/GenerateHelper.cs index e62a5cd3..97dac50b 100644 --- a/src/Atc.Rest.ApiGenerator/Helpers/GenerateHelper.cs +++ b/src/Atc.Rest.ApiGenerator/Helpers/GenerateHelper.cs @@ -133,8 +133,8 @@ public static bool GenerateServerSln( ArgumentNullException.ThrowIfNull(srcPath); var projectName = projectPrefixName - .Replace(" ", ".", StringComparison.Ordinal) - .Replace("-", ".", StringComparison.Ordinal) + .Replace(' ', '.') + .Replace('-', '.') .Trim(); var rootPath = outputSlnPath.EndsWith(".sln", StringComparison.OrdinalIgnoreCase) diff --git a/src/Atc.Rest.ApiGenerator/Models/BaseProjectOptions.cs b/src/Atc.Rest.ApiGenerator/Models/BaseProjectOptions.cs index 7dff6154..4de23d27 100644 --- a/src/Atc.Rest.ApiGenerator/Models/BaseProjectOptions.cs +++ b/src/Atc.Rest.ApiGenerator/Models/BaseProjectOptions.cs @@ -48,12 +48,12 @@ protected BaseProjectOptions( RouteBase = openApiDocument.GetServerUrlBasePath(); ProjectName = string.IsNullOrEmpty(projectSuffixName) ? projectPrefixName - .Replace(" ", ".", StringComparison.Ordinal) - .Replace("-", ".", StringComparison.Ordinal) + .Replace(' ', '.') + .Replace('-', '.') .Trim() : projectPrefixName - .Replace(" ", ".", StringComparison.Ordinal) - .Replace("-", ".", StringComparison.Ordinal) + .Replace(' ', '.') + .Replace('-', '.') .Trim() + $".{projectSuffixName}"; ProjectPrefixName = ProjectName.Contains('.', StringComparison.Ordinal)