You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
735 B
C#

using DS.Module.Core.Helpers;
12 months ago
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace DS.Module.Core;
public class CustomContractResolver : CamelCasePropertyNamesContractResolver
{
/// <summary>
/// 对长整型做处理
/// </summary>
/// <param name="objectType"></param>
/// <returns></returns>
protected override JsonConverter ResolveContractConverter(Type objectType)
{
if (objectType == typeof(long))
{
return new JsonConverterLong();
}
if (objectType == typeof(DateTime?) || objectType == typeof(DateTime))
{
return new DatetimeJsonConverter();
}
12 months ago
return base.ResolveContractConverter(objectType);
}
}