|
|
|
@ -19,7 +19,7 @@ public class CSharpServiceProxyGenerator : ServiceProxyGeneratorBase<CSharpServi |
|
|
|
|
|
|
|
private const string ProxyDirectory = "ClientProxies"; |
|
|
|
|
|
|
|
private static readonly string[] ServicePostfixes = { "AppService", "ApplicationService", "IntService", "IntegrationService" , "Service"}; |
|
|
|
private readonly static string[] ServicePostfixes = { "AppService", "ApplicationService", "IntService", "IntegrationService" , "Service"}; |
|
|
|
private const string AppServicePrefix = "Volo.Abp.Application.Services"; |
|
|
|
|
|
|
|
private const string NamespacePlaceholder = "<namespace>"; |
|
|
|
@ -29,7 +29,7 @@ public class CSharpServiceProxyGenerator : ServiceProxyGeneratorBase<CSharpServi |
|
|
|
private const string ClassNamePlaceholder = "<className>"; |
|
|
|
private const string ServiceInterfacePlaceholder = "<serviceInterface>"; |
|
|
|
private const string DtoClassNamePlaceholder = "<dtoName>"; |
|
|
|
private static readonly string ClassTemplate = "// This file is automatically generated by ABP framework to use MVC Controllers from CSharp" + |
|
|
|
private readonly static string ClassTemplate = "// This file is automatically generated by ABP framework to use MVC Controllers from CSharp" + |
|
|
|
$"{Environment.NewLine}<using>" + |
|
|
|
$"{Environment.NewLine}" + |
|
|
|
$"{Environment.NewLine}// ReSharper disable once CheckNamespace" + |
|
|
|
@ -44,7 +44,7 @@ public class CSharpServiceProxyGenerator : ServiceProxyGeneratorBase<CSharpServi |
|
|
|
$"{Environment.NewLine}}}" + |
|
|
|
$"{Environment.NewLine}"; |
|
|
|
|
|
|
|
private static readonly string ClassTemplateEmptyPart = "// This file is part of <className>, you can customize it here" + |
|
|
|
private readonly static string ClassTemplateEmptyPart = "// This file is part of <className>, you can customize it here" + |
|
|
|
$"{Environment.NewLine}// ReSharper disable once CheckNamespace" + |
|
|
|
$"{Environment.NewLine}namespace <namespace>;" + |
|
|
|
$"{Environment.NewLine}" + |
|
|
|
@ -53,7 +53,7 @@ public class CSharpServiceProxyGenerator : ServiceProxyGeneratorBase<CSharpServi |
|
|
|
$"{Environment.NewLine}}}" + |
|
|
|
$"{Environment.NewLine}"; |
|
|
|
|
|
|
|
private static readonly string InterfaceTemplate = "// This file is automatically generated by ABP framework to use MVC Controllers from CSharp" + |
|
|
|
private readonly static string InterfaceTemplate = "// This file is automatically generated by ABP framework to use MVC Controllers from CSharp" + |
|
|
|
$"{Environment.NewLine}<using>" + |
|
|
|
$"{Environment.NewLine}" + |
|
|
|
$"{Environment.NewLine}// ReSharper disable once CheckNamespace" + |
|
|
|
@ -65,24 +65,22 @@ public class CSharpServiceProxyGenerator : ServiceProxyGeneratorBase<CSharpServi |
|
|
|
$"{Environment.NewLine}}}" + |
|
|
|
$"{Environment.NewLine}"; |
|
|
|
|
|
|
|
private static readonly string DtoTemplate = "// This file is automatically generated by ABP framework to use MVC Controllers from CSharp" + |
|
|
|
$"{Environment.NewLine}using System;" + |
|
|
|
$"{Environment.NewLine}using System.Collections.Generic;" + |
|
|
|
$"{Environment.NewLine}using Volo.Abp.Application.Dtos;" + |
|
|
|
$"{Environment.NewLine}using Volo.Abp.ObjectExtending;" + |
|
|
|
$"{Environment.NewLine}<using>" + |
|
|
|
$"{Environment.NewLine}" + |
|
|
|
$"{Environment.NewLine}// ReSharper disable once CheckNamespace" + |
|
|
|
$"{Environment.NewLine}namespace <namespace>;" + |
|
|
|
$"{Environment.NewLine}" + |
|
|
|
$"{Environment.NewLine}public <dtoName>" + |
|
|
|
$"{Environment.NewLine}{{" + |
|
|
|
$"{Environment.NewLine} <property>" + |
|
|
|
$"{Environment.NewLine}}}" + |
|
|
|
$"{Environment.NewLine}"; |
|
|
|
private static readonly List<string> ClassUsingNamespaceList = new() |
|
|
|
private readonly static string DtoTemplate = "// This file is automatically generated by ABP framework to use MVC Controllers from CSharp" + |
|
|
|
$"{Environment.NewLine}<using>" + |
|
|
|
$"{Environment.NewLine}" + |
|
|
|
$"{Environment.NewLine}// ReSharper disable once CheckNamespace" + |
|
|
|
$"{Environment.NewLine}namespace <namespace>;" + |
|
|
|
$"{Environment.NewLine}" + |
|
|
|
$"{Environment.NewLine}public <dtoName>" + |
|
|
|
$"{Environment.NewLine}{{" + |
|
|
|
$"{Environment.NewLine} <property>" + |
|
|
|
$"{Environment.NewLine}}}" + |
|
|
|
$"{Environment.NewLine}"; |
|
|
|
|
|
|
|
private readonly static List<string> ClassUsingNamespaceList = new() |
|
|
|
{ |
|
|
|
"using System;", |
|
|
|
"using System.Collections.Generic;", |
|
|
|
"using System.Threading.Tasks;", |
|
|
|
"using Volo.Abp.Application.Dtos;", |
|
|
|
"using Volo.Abp.Http.Client;", |
|
|
|
@ -91,14 +89,23 @@ public class CSharpServiceProxyGenerator : ServiceProxyGeneratorBase<CSharpServi |
|
|
|
"using Volo.Abp.Http.Client.ClientProxying;" |
|
|
|
}; |
|
|
|
|
|
|
|
private static readonly List<string> InterfaceUsingNamespaceList = new() |
|
|
|
private readonly static List<string> InterfaceUsingNamespaceList = new() |
|
|
|
{ |
|
|
|
"using System;", |
|
|
|
"using System.Collections.Generic;", |
|
|
|
"using System.Threading.Tasks;", |
|
|
|
"using Volo.Abp.Application.Dtos;", |
|
|
|
"using Volo.Abp.Application.Services;" |
|
|
|
}; |
|
|
|
|
|
|
|
private readonly static List<string> DtoUsingNamespaceList = new() |
|
|
|
{ |
|
|
|
"using System;", |
|
|
|
"using System.Collections.Generic;", |
|
|
|
"using Volo.Abp.Application.Dtos;", |
|
|
|
"using Volo.Abp.ObjectExtending;", |
|
|
|
}; |
|
|
|
|
|
|
|
public CSharpServiceProxyGenerator( |
|
|
|
CliHttpClientFactory cliHttpClientFactory, |
|
|
|
IJsonSerializer jsonSerializer) : |
|
|
|
@ -106,7 +113,7 @@ public class CSharpServiceProxyGenerator : ServiceProxyGeneratorBase<CSharpServi |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
public override async Task GenerateProxyAsync(GenerateProxyArgs args) |
|
|
|
public async override Task GenerateProxyAsync(GenerateProxyArgs args) |
|
|
|
{ |
|
|
|
CheckWorkDirectory(args.WorkDirectory); |
|
|
|
CheckFolder(args.Folder); |
|
|
|
@ -418,7 +425,7 @@ public class CSharpServiceProxyGenerator : ServiceProxyGeneratorBase<CSharpServi |
|
|
|
foreach (var type in applicationApiDescriptionModel.Types.Where(x => types.Contains(x.Key))) |
|
|
|
{ |
|
|
|
var dto = new StringBuilder(DtoTemplate); |
|
|
|
var dtoUsingNamespaceList = new List<string>() |
|
|
|
var dtoUsingNamespaceList = new List<string>(DtoUsingNamespaceList) |
|
|
|
{ |
|
|
|
$"using {GetTypeNamespace(type.Key)};" |
|
|
|
}; |
|
|
|
@ -478,7 +485,7 @@ public class CSharpServiceProxyGenerator : ServiceProxyGeneratorBase<CSharpServi |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
dto.Replace($"{UsingPlaceholder}", string.Join(Environment.NewLine, dtoUsingNamespaceList.OrderBy(x => x).Select(x => x))); |
|
|
|
dto.Replace($"{UsingPlaceholder}", string.Join(Environment.NewLine, dtoUsingNamespaceList.Distinct().OrderBy(x => x).Select(x => x))); |
|
|
|
dto.Replace(PropertyPlaceholder, properties.ToString()); |
|
|
|
|
|
|
|
var folder = args.Folder.IsNullOrWhiteSpace() |
|
|
|
|