Files
BeWoPlaner/Shared/Core/ShouldSerializeContractResolver.cs
2016-06-27 01:45:38 +02:00

20 lines
578 B
C#

using System.Reflection;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace BS.Shared.Core
{
public class ShouldSerializeContractResolver : DefaultContractResolver
{
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
{
var property = base.CreateProperty(member, memberSerialization);
if (property.PropertyName.Equals("ObjVersionValue") || property.PropertyName.Equals("DefaultAddress"))
property.ShouldSerialize = instance => false;
return property;
}
}
}