Browse Source

GenerateProxyCommand create type bug fix

pull/3138/head
Arkat Erol 7 years ago
parent
commit
746deb05b2
  1. 14
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs

14
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs

@ -334,7 +334,7 @@ namespace Volo.Abp.Cli.Commands
} }
private static string CreateType(JObject data, string returnValueType, string rootPath, List<string> modelIndexList) private static string CreateType(JObject data, string returnValueType, string rootPath, List<string> modelIndexList)
{ {
var type = data["types"][returnValueType]; var type = data["types"][returnValueType];
if (type == null) if (type == null)
@ -388,10 +388,16 @@ namespace Volo.Abp.Cli.Commands
if (baseTypeName.Contains("guid") || baseTypeName.Contains("Guid")) if (baseTypeName.Contains("guid") || baseTypeName.Contains("Guid"))
{ {
baseTypeName = "string"; baseTypeName = "string";
} }
modelFileText.AppendLine($"import {{ {baseTypeName} }} from '{baseTypeKebabCase}';"); modelFileText.AppendLine($"import {{ {baseTypeName} }} from '{baseTypeKebabCase}';");
extends = "extends " + (!string.IsNullOrWhiteSpace(customBaseTypeName) ? customBaseTypeName : baseTypeName); extends = "extends " + (!string.IsNullOrWhiteSpace(customBaseTypeName) ? customBaseTypeName : baseTypeName);
var modelIndex = CreateType(data, baseType, rootPath, modelIndexList);
if (!string.IsNullOrWhiteSpace(modelIndex))
{
modelIndexList.Add(modelIndex);
}
} }
if (baseType == "System.Enum" && (bool)type["isEnum"]) if (baseType == "System.Enum" && (bool)type["isEnum"])
@ -421,11 +427,11 @@ namespace Volo.Abp.Cli.Commands
var modelIndex = CreateType(data, (string)property["type"], rootPath, modelIndexList); var modelIndex = CreateType(data, (string)property["type"], rootPath, modelIndexList);
if (!string.IsNullOrWhiteSpace(modelIndex)) if (!string.IsNullOrWhiteSpace(modelIndex))
{ {
var propertyTypeSplit = ((string)property["type"]).Split("."); var propertyTypeSplit = ((string)property["type"]).Split(".");
var propertyType = propertyTypeSplit[propertyTypeSplit.Length - 1]; var propertyType = propertyTypeSplit[propertyTypeSplit.Length - 1];
modelFileText.Insert(0,""); modelFileText.Insert(0,"");
modelFileText.Insert(0, $"import {{ {propertyType} }} from '../models';"); modelFileText.Insert(0, $"import {{ {propertyType} }} from '../models';");
modelFileText.Insert(0, ""); modelFileText.Insert(0, "");
modelIndexList.Add(modelIndex); modelIndexList.Add(modelIndex);
} }

Loading…
Cancel
Save