-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7916 from abpframework/cotur/api-scripting
PropertyNameGenerator moved to static class
- Loading branch information
Showing
3 changed files
with
33 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
....Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using System.Reflection; | ||
|
||
namespace Volo.Abp.Http.ProxyScripting.Configuration | ||
{ | ||
public static class AbpApiProxyScriptingConfiguration | ||
{ | ||
public static Func<PropertyInfo, string> PropertyNameGenerator { get; set; } | ||
|
||
static AbpApiProxyScriptingConfiguration() | ||
{ | ||
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; | ||
}; | ||
} | ||
} | ||
} |
25 changes: 0 additions & 25 deletions
25
...c/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters