Browse Source

Use simplified type name for api descriptions.

pull/113/head
Halil İbrahim Kalkan 9 years ago
parent
commit
c590b7b2d4
  1. 2
      src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs
  2. 2
      src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ActionApiDescriptionModel.cs
  3. 6
      src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs
  4. 2
      src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs
  5. 2
      src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs
  6. 2
      src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs
  7. 16
      src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs
  8. 2
      src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs
  9. 10
      src/Volo.Abp/System/AbpTypeExtensions.cs

2
src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs

@ -41,7 +41,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying
for (int i = 0; i < methodParameters.Length; i++) 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; found = false;
break; break;

2
src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ActionApiDescriptionModel.cs

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

6
src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs

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

2
src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs

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

2
src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs

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

2
src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs

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

16
src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs

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

2
src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs

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

10
src/Volo.Abp/System/AbpTypeExtensions.cs

@ -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