27 lines
912 B
C#
27 lines
912 B
C#
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace Mapster;
|
|
|
|
public class AdapterCfg
|
|
{
|
|
public static TypeAdapterConfig IgnoreNull { get; internal set; }
|
|
public static TypeAdapterConfig ExactCase { get; internal set; }
|
|
|
|
static AdapterCfg()
|
|
{
|
|
IgnoreNull = TypeAdapterConfig.GlobalSettings.Clone();
|
|
IgnoreNull.Default.IgnoreNullValues(true);
|
|
|
|
ExactCase = TypeAdapterConfig.GlobalSettings.Clone();
|
|
ExactCase.Default.NameMatchingStrategy(NameMatchingStrategy.Exact);
|
|
}
|
|
|
|
public static void ConfigGlobal()
|
|
{
|
|
TypeAdapterConfig.GlobalSettings.Default.PreserveReference(true);
|
|
TypeAdapterConfig.GlobalSettings.NewConfig<JToken, JToken>().MapWith(json => json);
|
|
TypeAdapterConfig.GlobalSettings.NewConfig<JObject, JObject>().MapWith(json => json);
|
|
TypeAdapterConfig.GlobalSettings.NewConfig<JArray, JArray>().MapWith(json => json);
|
|
}
|
|
} |