Table of Contents

Class IncludingContractResolver

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

Newtonsoft.Json ContractResolver that can be configured to include properties by name. Allows JSON serializer to skip certain properties, thus preventing the serializer from trying to serialize the entire object graph. Serializes value types and System types by default, but excludes all collections and other types unless explicitly included.

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

Constructors

IncludingContractResolver(IDictionary<Type, List<string>>)

Configure the included property names using a dictionary of { Type -> List of property names to include }

public IncludingContractResolver(IDictionary<Type, List<string>> includedTypeMembers)

Parameters

includedTypeMembers IDictionary<Type, List<string>>

IncludingContractResolver(params string[])

Configure the included property names using an array of strings

public IncludingContractResolver(params string[] includedMembers)

Parameters

includedMembers string[]

Names of properties to be included

Methods

GetSerializableMembers(Type)

Returns the list of property and field names that should be serialized on a given type.

protected override List<MemberInfo> GetSerializableMembers(Type objectType)

Parameters

objectType Type

Returns

List<MemberInfo>

IsIncluded(Type, Type, string)

For a given property type, containing type, and property name, return true if it should be serialized and false if not. By default, value types and system types are serialized, but collections and custom types are not.

protected bool IsIncluded(Type propertyType, Type containingType, string name)

Parameters

propertyType Type
containingType Type
name string

Returns

bool