Browse Source

Merge pull request #23852 from abpframework/auto-merge/rel-9-3/4005

Merge branch rel-10.0 with rel-9.3
auto-merge/rel-10-0/4007
Ma Liming 10 months ago
committed by GitHub
parent
commit
2997d3ecff
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 12
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/CSharp/CSharpServiceProxyGenerator.cs

12
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/CSharp/CSharpServiceProxyGenerator.cs

@ -9,6 +9,7 @@ using Volo.Abp.Cli.Commands;
using Volo.Abp.Cli.Http;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Modeling;
using Volo.Abp.IO;
using Volo.Abp.Json;
namespace Volo.Abp.Cli.ServiceProxying.CSharp;
@ -162,7 +163,10 @@ public class CSharpServiceProxyGenerator : ServiceProxyGeneratorBase<CSharpServi
private async Task CreateJsonFile(GenerateProxyArgs args, ApplicationApiDescriptionModel applicationApiDescriptionModel)
{
var folder = args.Folder.IsNullOrWhiteSpace() ? ProxyDirectory : args.Folder;
var filePath = Path.Combine(args.WorkDirectory, folder, $"{args.Module}-generate-proxy.json");
var directory = Path.Combine(args.WorkDirectory, folder);
DirectoryHelper.CreateIfNotExists(directory);
var filePath = Path.Combine(directory, $"{args.Module}-generate-proxy.json");
using (var writer = new StreamWriter(filePath))
{
await writer.WriteAsync(JsonSerializer.Serialize(applicationApiDescriptionModel, indented: true));
@ -187,7 +191,7 @@ public class CSharpServiceProxyGenerator : ServiceProxyGeneratorBase<CSharpServi
classTemplateEmptyPart.Replace(NamespacePlaceholder, rootNamespace);
var filePath = Path.Combine(args.WorkDirectory, folder, $"{clientProxyName}.cs");
Directory.CreateDirectory(Path.GetDirectoryName(filePath));
DirectoryHelper.CreateIfNotExists(Path.GetDirectoryName(filePath)!);
if (!File.Exists(filePath))
{
using (var writer = new StreamWriter(filePath))
@ -223,7 +227,7 @@ public class CSharpServiceProxyGenerator : ServiceProxyGeneratorBase<CSharpServi
classTemplate.Replace($"{Environment.NewLine}{Environment.NewLine} {MethodPlaceholder}", string.Empty).Replace(MethodPlaceholder, string.Empty);
filePath = Path.Combine(args.WorkDirectory, folder, $"{clientProxyName}.Generated.cs");
Directory.CreateDirectory(Path.GetDirectoryName(filePath));
DirectoryHelper.CreateIfNotExists(Path.GetDirectoryName(filePath)!);
using (var writer = new StreamWriter(filePath))
{
await writer.WriteAsync(classTemplate.ToString());
@ -253,7 +257,7 @@ public class CSharpServiceProxyGenerator : ServiceProxyGeneratorBase<CSharpServi
interfaceTemplate.Replace(NamespacePlaceholder, rootNamespace);
filePath = Path.Combine(args.WorkDirectory, folder, $"{appServiceTypeName}.cs");
Directory.CreateDirectory(Path.GetDirectoryName(filePath));
DirectoryHelper.CreateIfNotExists(Path.GetDirectoryName(filePath)!);
using (var writer = new StreamWriter(filePath))
{
await writer.WriteAsync(interfaceTemplate.ToString());

Loading…
Cancel
Save