maliming
4 years ago
No known key found for this signature in database
GPG Key ID: 96224957E51C89E
2 changed files with
4 additions and
20 deletions
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProxyCommandBase.cs
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/CSharp/CSharpServiceProxyGenerator.cs
|
|
|
@ -68,9 +68,9 @@ public abstract class ProxyCommandBase<T> : IConsoleCommand, ITransientDependenc |
|
|
|
var source = commandLineArgs.Options.GetOrNull(Options.Source.Short, Options.Source.Long); |
|
|
|
var workDirectory = commandLineArgs.Options.GetOrNull(Options.WorkDirectory.Short, Options.WorkDirectory.Long) ?? Directory.GetCurrentDirectory(); |
|
|
|
var folder = commandLineArgs.Options.GetOrNull(Options.Folder.Long); |
|
|
|
var withContracts = commandLineArgs.Options.ContainsKey(Options.WithoutContracts.Long); |
|
|
|
var withoutContracts = commandLineArgs.Options.ContainsKey(Options.WithoutContracts.Long); |
|
|
|
|
|
|
|
return new GenerateProxyArgs(CommandName, workDirectory, module, url, output, target, apiName, source, folder, withContracts, commandLineArgs.Options); |
|
|
|
return new GenerateProxyArgs(CommandName, workDirectory, module, url, output, target, apiName, source, folder, withoutContracts, commandLineArgs.Options); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual string GetUsageInfo() |
|
|
|
|
|
|
|
@ -130,13 +130,8 @@ public class CSharpServiceProxyGenerator : ServiceProxyGeneratorBase<CSharpServi |
|
|
|
IncludeTypes = !args.WithoutContracts |
|
|
|
}); |
|
|
|
|
|
|
|
foreach (var controller in applicationApiDescriptionModel.Modules.Values.SelectMany(x => x.Controllers) |
|
|
|
.Where(x => x.Value.Interfaces.Any() && ServicePostfixes.Any(s => x.Value.Interfaces.Last().Type.EndsWith(s)))) |
|
|
|
{ |
|
|
|
await GenerateClassFileAsync(args, controller.Value); |
|
|
|
} |
|
|
|
|
|
|
|
foreach (var controller in applicationApiDescriptionModel.Modules.Values.SelectMany(x => x.Controllers).Where(x => ShouldGenerateProxy(x.Value))) |
|
|
|
foreach (var controller in applicationApiDescriptionModel.Modules.Values.SelectMany(x => x.Controllers). |
|
|
|
Where(x => x.Value.Interfaces.Any() && ServicePostfixes.Any(s => x.Value.Interfaces.Last().Type.EndsWith(s)))) |
|
|
|
{ |
|
|
|
await GenerateClassFileAsync(args, controller.Value); |
|
|
|
} |
|
|
|
@ -149,17 +144,6 @@ public class CSharpServiceProxyGenerator : ServiceProxyGeneratorBase<CSharpServi |
|
|
|
await CreateJsonFile(args, applicationApiDescriptionModel); |
|
|
|
} |
|
|
|
|
|
|
|
private bool ShouldGenerateProxy(ControllerApiDescriptionModel controllerApiDescription) |
|
|
|
{ |
|
|
|
if (!controllerApiDescription.Interfaces.Any()) |
|
|
|
{ |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
var serviceInterface = controllerApiDescription.Interfaces.Last(); |
|
|
|
return ServicePostfixes.Any(x => serviceInterface.Type.EndsWith(x)); |
|
|
|
} |
|
|
|
|
|
|
|
private async Task CreateJsonFile(GenerateProxyArgs args, ApplicationApiDescriptionModel applicationApiDescriptionModel) |
|
|
|
{ |
|
|
|
var folder = args.Folder.IsNullOrWhiteSpace() ? ProxyDirectory : args.Folder; |
|
|
|
|