Browse Source

Implementing JsonName generating for PropertyApiDescriptionModel

pull/7819/head
Ahmet 6 years ago
parent
commit
d06c654d3e
  1. 4
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs
  2. 2
      framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingOptions.cs

4
framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs

@ -1,6 +1,7 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Reflection;
using Volo.Abp.Http.ProxyScripting.Configuration;
namespace Volo.Abp.Http.Modeling
{
@ -9,6 +10,8 @@ namespace Volo.Abp.Http.Modeling
{
public string Name { get; set; }
public string JsonName { get; set; }
public string Type { get; set; }
public string TypeSimple { get; set; }
@ -21,6 +24,7 @@ namespace Volo.Abp.Http.Modeling
return new PropertyApiDescriptionModel
{
Name = propertyInfo.Name,
JsonName = AbpApiProxyScriptingOptions.PropertyNameGenerator.Invoke(propertyInfo),
Type = ApiTypeNameHelper.GetTypeName(propertyInfo.PropertyType),
TypeSimple = ApiTypeNameHelper.GetSimpleTypeName(propertyInfo.PropertyType),
IsRequired = propertyInfo.IsDefined(typeof(RequiredAttribute), true)

2
framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingOptions.cs

@ -8,7 +8,7 @@ namespace Volo.Abp.Http.ProxyScripting.Configuration
{
public IDictionary<string, Type> Generators { get; }
public Func<PropertyInfo, string> PropertyNameGenerator { get; set; }
public static Func<PropertyInfo, string> PropertyNameGenerator { get; set; }
public AbpApiProxyScriptingOptions()
{

Loading…
Cancel
Save