DefaultContractResolver Class

Namespace: Stimulsoft.Base.Json.Serialization

Used by JsonSerializer to resolves a JsonContract for a given Type.

Inheritance

Implements: IContractResolver

Constructors

Constructor Description
DefaultContractResolver() Initializes a new instance of the DefaultContractResolver class.
DefaultContractResolver(bool shareCache)  

DefaultContractResolver()

Initializes a new instance of the DefaultContractResolver class.


DefaultContractResolver(shareCache: bool)

Parameters

  • shareCache (bool)

Properties

Property Type Description
DefaultMembersSearchFlags BindingFlags  
IgnoreSerializableAttribute bool Gets or sets a value indicating whether to ignore the SerializableAttribute attribute when serializing and deserializing types.
IgnoreSerializableInterface bool Gets or sets a value indicating whether to ignore the ISerializable interface when serializing and deserializing types.
SerializeCompilerGeneratedMembers bool Gets or sets a value indicating whether compiler generated members should be serialized.

Methods

Method Returns Description
CreateArrayContract JsonArrayContract Creates a JsonArrayContract for the given type.
CreateConstructorParameters IList<JsonProperty> Creates the constructor parameters.
CreateContract JsonContract Determines which contract type is created for the given type.
CreateDictionaryContract JsonDictionaryContract Creates a JsonDictionaryContract for the given type.
CreateDynamicContract JsonDynamicContract Creates a JsonDynamicContract for the given type.
CreateISerializableContract JsonISerializableContract Creates a JsonISerializableContract for the given type.
CreateLinqContract JsonLinqContract Creates a JsonLinqContract for the given type.
CreateMemberValueProvider IValueProvider Creates the IValueProvider used by the serializer to get and set values from a member.
CreateObjectContract JsonObjectContract Creates a JsonObjectContract for the given type.
CreatePrimitiveContract JsonPrimitiveContract Creates a JsonPrimitiveContract for the given type.
CreateProperties IList<JsonProperty> Creates properties for the given JsonContract.
CreateProperty JsonProperty Creates a JsonProperty for the given MemberInfo.
CreatePropertyFromConstructorParameter JsonProperty Creates a JsonProperty for the given ParameterInfo.
CreateStringContract JsonStringContract Creates a JsonStringContract for the given type.
Dispose void  
GetResolvedPropertyName string Gets the resolved name of the property.
GetSerializableMembers List Gets the serializable members for the type.
MoveNext bool  
Reset void  
ResolveContract JsonContract Resolves the contract for a given type.
ResolveContractConverter JsonConverter Resolves the default JsonConverter for the contract.

Method Details

CreateArrayContract

CreateArrayContract(objectType: Type): JsonArrayContract

Creates a JsonArrayContract for the given type.

Parameters

  • objectType (Type) — Type of the object.

Returns JsonArrayContract — A JsonArrayContract for the given type.


CreateConstructorParameters

CreateConstructorParameters(constructor: ConstructorInfo, memberProperties: JsonPropertyCollection): IList<JsonProperty>

Creates the constructor parameters.

Parameters

  • constructor (ConstructorInfo) — The constructor to create properties for.
  • memberProperties (JsonPropertyCollection) — The type’s member properties.

Returns IList<JsonProperty> — Properties for the given ConstructorInfo.


CreateContract

CreateContract(objectType: Type): JsonContract

Determines which contract type is created for the given type.

Parameters

  • objectType (Type) — Type of the object.

Returns JsonContract — A JsonContract for the given type.


CreateDictionaryContract

CreateDictionaryContract(objectType: Type): JsonDictionaryContract

Creates a JsonDictionaryContract for the given type.

Parameters

  • objectType (Type) — Type of the object.

Returns JsonDictionaryContract — A JsonDictionaryContract for the given type.


CreateDynamicContract

CreateDynamicContract(objectType: Type): JsonDynamicContract

Creates a JsonDynamicContract for the given type.

Parameters

  • objectType (Type) — Type of the object.

Returns JsonDynamicContract — A JsonDynamicContract for the given type.


CreateISerializableContract

CreateISerializableContract(objectType: Type): JsonISerializableContract

Creates a JsonISerializableContract for the given type.

Parameters

  • objectType (Type) — Type of the object.

Returns JsonISerializableContract — A JsonISerializableContract for the given type.


CreateLinqContract

CreateLinqContract(objectType: Type): JsonLinqContract

Creates a JsonLinqContract for the given type.

Parameters

  • objectType (Type) — Type of the object.

Returns JsonLinqContract — A JsonLinqContract for the given type.


CreateMemberValueProvider

CreateMemberValueProvider(member: MemberInfo): IValueProvider

Creates the IValueProvider used by the serializer to get and set values from a member.

Parameters

  • member (MemberInfo) — The member.

Returns IValueProvider — The IValueProvider used by the serializer to get and set values from a member.


CreateObjectContract

CreateObjectContract(objectType: Type): JsonObjectContract

Creates a JsonObjectContract for the given type.

Parameters

  • objectType (Type) — Type of the object.

Returns JsonObjectContract — A JsonObjectContract for the given type.


CreatePrimitiveContract

CreatePrimitiveContract(objectType: Type): JsonPrimitiveContract

Creates a JsonPrimitiveContract for the given type.

Parameters

  • objectType (Type) — Type of the object.

Returns JsonPrimitiveContract — A JsonPrimitiveContract for the given type.


CreateProperties

CreateProperties(type: Type, memberSerialization: MemberSerialization): IList<JsonProperty>

Creates properties for the given JsonContract.

Parameters

  • type (Type) — The type to create properties for.
  • memberSerialization (MemberSerialization) — The member serialization mode for the type.

Returns IList<JsonProperty> — Properties for the given JsonContract.


CreateProperty

CreateProperty(member: MemberInfo, memberSerialization: MemberSerialization): JsonProperty

Creates a JsonProperty for the given MemberInfo.

Parameters

  • member (MemberInfo) — The member to create a JsonProperty for.
  • memberSerialization (MemberSerialization) — The member’s parent MemberSerialization.

Returns JsonProperty — A created JsonProperty for the given MemberInfo.


CreatePropertyFromConstructorParameter

CreatePropertyFromConstructorParameter(matchingMemberProperty: JsonProperty, parameterInfo: ParameterInfo): JsonProperty

Creates a JsonProperty for the given ParameterInfo.

Parameters

  • matchingMemberProperty (JsonProperty) — The matching member property.
  • parameterInfo (ParameterInfo) — The constructor parameter.

Returns JsonProperty — A created JsonProperty for the given ParameterInfo.


CreateStringContract

CreateStringContract(objectType: Type): JsonStringContract

Creates a JsonStringContract for the given type.

Parameters

  • objectType (Type) — Type of the object.

Returns JsonStringContract — A JsonStringContract for the given type.


Dispose

Dispose(): void


GetResolvedPropertyName

GetResolvedPropertyName(propertyName: string): string

Gets the resolved name of the property.

Parameters

  • propertyName (string) — Name of the property.

Returns string — Name of the property.


GetSerializableMembers

GetSerializableMembers(objectType: Type): List

Gets the serializable members for the type.

Parameters

  • objectType (Type) — The type to get serializable members for.

Returns List — The serializable members for the type.


MoveNext

MoveNext(): bool

Returns bool


Reset

Reset(): void


ResolveContract

ResolveContract(type: Type): JsonContract

Resolves the contract for a given type.

Parameters

  • type (Type) — The type to resolve a contract for.

Returns JsonContract — The contract for a given type.


ResolveContractConverter

ResolveContractConverter(objectType: Type): JsonConverter

Resolves the default JsonConverter for the contract.

Parameters

  • objectType (Type) — Type of the object.

Returns JsonConverter — The contract’s default JsonConverter.