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
-
DefaultContractResolverIncludingContractResolver
- Implements
-
IContractResolver
- Inherited Members
-
DefaultContractResolver.DynamicCodeGenerationDefaultContractResolver.DefaultMembersSearchFlagsDefaultContractResolver.SerializeCompilerGeneratedMembersDefaultContractResolver.IgnoreSerializableInterfaceDefaultContractResolver.IgnoreSerializableAttributeDefaultContractResolver.IgnoreIsSpecifiedMembersDefaultContractResolver.IgnoreShouldSerializeMembersDefaultContractResolver.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
includedTypeMembersIDictionary<Type, List<string>>
IncludingContractResolver(params string[])
Configure the included property names using an array of strings
public IncludingContractResolver(params string[] includedMembers)
Parameters
includedMembersstring[]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
objectTypeType
Returns
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)