Table of Contents

Class ExcludingContractResolver

Namespace
Breeze.Persistence.NH
Assembly
Breeze.Persistence.NH.dll

Newtonsoft.Json ContractResolver that can be configured to exclude certain properties by name. Allows JSON serializer to skip certain properties, thus preventing the serializer from trying to serialize the entire object graph.

public class ExcludingContractResolver : DefaultContractResolver, IContractResolver
Inheritance
DefaultContractResolver
ExcludingContractResolver
Implements
IContractResolver
Inherited Members
DefaultContractResolver.DynamicCodeGeneration
DefaultContractResolver.DefaultMembersSearchFlags
DefaultContractResolver.SerializeCompilerGeneratedMembers
DefaultContractResolver.IgnoreSerializableInterface
DefaultContractResolver.IgnoreSerializableAttribute
DefaultContractResolver.IgnoreIsSpecifiedMembers
DefaultContractResolver.IgnoreShouldSerializeMembers
DefaultContractResolver.NamingStrategy

Constructors

ExcludingContractResolver(string[])

Define the properties that should be excluded. Two different methods can be used:

  1. The simple property name, e.g. "Orders". This will exclude properties with that name from anywhere in the object graph.
  2. The declaring type name + '.' + property name, e.g. "Customer.Orders". This will exclude the property name from that type only.
public ExcludingContractResolver(string[] excludedMembers)

Parameters

excludedMembers string[]

Methods

GetSerializableMembers(Type)

Drop the excluded properties from the members Json.NET would otherwise serialize.

protected override List<MemberInfo> GetSerializableMembers(Type objectType)

Parameters

objectType Type

The type being serialized.

Returns

List<MemberInfo>

The members to serialize, minus any matched by name or by declaring type and name.