Use simplified type name for api descriptions.

pull/112/head
Halil İbrahim Kalkan 8 years ago
parent f0cb66a518
commit c590b7b2d4

@ -41,7 +41,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying
for (int i = 0; i < methodParameters.Length; i++)
{
if (action.ParametersOnMethod[i].TypeAsString != methodParameters[i].ParameterType.FullName)
if (action.ParametersOnMethod[i].TypeAsString != methodParameters[i].ParameterType.GetFullNameWithAssemblyName())
{
found = false;
break;

@ -36,7 +36,7 @@ namespace Volo.Abp.Http.Modeling
NameOnClass = method.Name,
Url = url,
HttpMethod = httpMethod,
ReturnValue = new ReturnValueApiDescriptionModel(method.ReturnType),
ReturnValue = ReturnValueApiDescriptionModel.Create(method.ReturnType),
Parameters = new List<ParameterApiDescriptionModel>(),
ParametersOnMethod = method
.GetParameters()

@ -13,7 +13,7 @@ namespace Volo.Abp.Http.Modeling
public List<ControllerInterfaceApiDescriptionModel> Interfaces { get; set; }
public Dictionary<string, ActionApiDescriptionModel> Actions { get; set; }
public Dictionary<string, ActionApiDescriptionModel> Actions { get; set; }
private ControllerApiDescriptionModel()
{
@ -25,7 +25,7 @@ namespace Volo.Abp.Http.Modeling
return new ControllerApiDescriptionModel
{
ControllerName = controllerName,
TypeAsString = type.FullName,
TypeAsString = type.GetFullNameWithAssemblyName(),
Actions = new Dictionary<string, ActionApiDescriptionModel>(),
Interfaces = type
.GetInterfaces()
@ -69,7 +69,7 @@ namespace Volo.Abp.Http.Modeling
public bool Implements(Type interfaceType)
{
return Interfaces.Any(i => i.TypeAsString == interfaceType.AssemblyQualifiedName);
return Interfaces.Any(i => i.TypeAsString == interfaceType.GetFullNameWithAssemblyName());
}
}
}

@ -16,7 +16,7 @@ namespace Volo.Abp.Http.Modeling
{
return new ControllerInterfaceApiDescriptionModel
{
TypeAsString = type.AssemblyQualifiedName
TypeAsString = type.GetFullNameWithAssemblyName()
};
}
}

@ -24,7 +24,7 @@ namespace Volo.Abp.Http.Modeling
return new MethodParameterApiDescriptionModel
{
Name = parameterInfo.Name,
TypeAsString = parameterInfo.ParameterType.FullName,
TypeAsString = parameterInfo.ParameterType.GetFullNameWithAssemblyName(),
IsOptional = parameterInfo.IsOptional,
DefaultValue = parameterInfo.HasDefaultValue ? parameterInfo.DefaultValue : null
};

@ -30,7 +30,7 @@ namespace Volo.Abp.Http.Modeling
{
Name = name,
NameOnMethod = nameOnMethod,
TypeAsString = type.FullName,
TypeAsString = type.GetFullNameWithAssemblyName(),
IsOptional = isOptional,
DefaultValue = defaultValue,
ConstraintTypes = constraintTypes,

@ -5,13 +5,19 @@ namespace Volo.Abp.Http.Modeling
[Serializable]
public class ReturnValueApiDescriptionModel
{
public Type Type { get; }
public string TypeAsString { get; }
public string TypeAsString { get; set; }
public ReturnValueApiDescriptionModel(Type type)
private ReturnValueApiDescriptionModel()
{
Type = type;
TypeAsString = type.FullName;
}
public static ReturnValueApiDescriptionModel Create(Type type)
{
return new ReturnValueApiDescriptionModel
{
TypeAsString = type.GetFullNameWithAssemblyName()
};
}
}
}

@ -90,7 +90,7 @@ namespace Volo.Abp.Http.ProxyScripting.Generators.JQuery
script.AppendLine(" url: abp.appPath + '" + ProxyScriptingHelper.GenerateUrlWithParameters(action) + "',");
script.Append(" type: '" + httpMethod + "'");
if (action.ReturnValue.Type == typeof(void))
if (action.ReturnValue.TypeAsString == typeof(void).GetFullNameWithAssemblyName())
{
script.AppendLine(",");
script.Append(" dataType: null");

@ -0,0 +1,10 @@
namespace System
{
public static class AbpTypeExtensions
{
public static string GetFullNameWithAssemblyName(this Type type)
{
return type.FullName + ", " + type.Assembly.GetName().Name;
}
}
}
Loading…
Cancel
Save