| 12345678910111213141516171819202122232425262728293031323334 |
- using System;
- using System.Reflection;
- using Abp.Reflection;
- using Abp.Timing;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Serialization;
- namespace Abp.Json
- {
- public class AbpContractResolver : DefaultContractResolver
- {
- protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
- {
- JsonProperty property = base.CreateProperty(member, memberSerialization);
- ModifyProperty(member, property);
- return property;
- }
- protected virtual void ModifyProperty(MemberInfo member, JsonProperty property)
- {
- if (property.PropertyType != typeof(DateTime) && property.PropertyType != typeof(DateTime?))
- {
- return;
- }
- if (ReflectionHelper.GetSingleAttributeOfMemberOrDeclaringTypeOrDefault<DisableDateTimeNormalizationAttribute>(member) == null)
- {
- property.Converter = new AbpDateTimeConverter();
- }
- }
- }
- }
|