docker
This commit is contained in:
@@ -1,25 +1,24 @@
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
namespace Back.Features
|
||||
{
|
||||
public class IgnorePropertiesResolver : DefaultContractResolver
|
||||
{
|
||||
private readonly HashSet<string> ignoreProps;
|
||||
public IgnorePropertiesResolver(IEnumerable<string> propNamesToIgnore)
|
||||
{
|
||||
this.ignoreProps = new HashSet<string>(propNamesToIgnore);
|
||||
}
|
||||
//public class IgnorePropertiesResolver : DefaultContractResolver
|
||||
//{
|
||||
// private readonly HashSet<string> ignoreProps;
|
||||
// public IgnorePropertiesResolver(IEnumerable<string> propNamesToIgnore)
|
||||
// {
|
||||
// this.ignoreProps = new HashSet<string>(propNamesToIgnore);
|
||||
// }
|
||||
|
||||
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
|
||||
{
|
||||
JsonProperty property = base.CreateProperty(member, memberSerialization);
|
||||
if (this.ignoreProps.Contains(property.PropertyName))
|
||||
{
|
||||
property.ShouldSerialize = _ => false;
|
||||
}
|
||||
return property;
|
||||
}
|
||||
}
|
||||
// protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
|
||||
// {
|
||||
// JsonProperty property = base.CreateProperty(member, memberSerialization);
|
||||
// if (this.ignoreProps.Contains(property.PropertyName))
|
||||
// {
|
||||
// property.ShouldSerialize = _ => false;
|
||||
// }
|
||||
// return property;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
Reference in New Issue
Block a user