|
|
@ -1,5 +1,6 @@ |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
|
|
|
using System.Reflection; |
|
|
|
|
|
|
|
|
namespace Volo.Abp.Http.ProxyScripting.Configuration |
|
|
namespace Volo.Abp.Http.ProxyScripting.Configuration |
|
|
{ |
|
|
{ |
|
|
@ -7,9 +8,30 @@ namespace Volo.Abp.Http.ProxyScripting.Configuration |
|
|
{ |
|
|
{ |
|
|
public IDictionary<string, Type> Generators { get; } |
|
|
public IDictionary<string, Type> Generators { get; } |
|
|
|
|
|
|
|
|
|
|
|
public Func<PropertyInfo, string> PropertyNameGenerator { get; set; } |
|
|
|
|
|
|
|
|
public AbpApiProxyScriptingOptions() |
|
|
public AbpApiProxyScriptingOptions() |
|
|
{ |
|
|
{ |
|
|
Generators = new Dictionary<string, Type>(); |
|
|
Generators = new Dictionary<string, Type>(); |
|
|
|
|
|
|
|
|
|
|
|
PropertyNameGenerator = propertyInfo => |
|
|
|
|
|
{ |
|
|
|
|
|
var jsonPropertyNameAttribute = propertyInfo.GetSingleAttributeOrNull<System.Text.Json.Serialization.JsonPropertyNameAttribute>(true); |
|
|
|
|
|
|
|
|
|
|
|
if (jsonPropertyNameAttribute != null) |
|
|
|
|
|
{ |
|
|
|
|
|
return jsonPropertyNameAttribute.Name; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var jsonPropertyAttribute = propertyInfo.GetSingleAttributeOrNull<Newtonsoft.Json.JsonPropertyAttribute>(true); |
|
|
|
|
|
|
|
|
|
|
|
if (jsonPropertyAttribute != null) |
|
|
|
|
|
{ |
|
|
|
|
|
return jsonPropertyAttribute.PropertyName; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
}; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |