MobileServiceContractResolver.CreateObjectContract(Type) Method

Definition

Creates a Newtonsoft.Json.Serialization.JsonObjectContract that provides information about how the given type should be serialized to JSON.

protected override Newtonsoft.Json.Serialization.JsonObjectContract CreateObjectContract (Type objectType);
override this.CreateObjectContract : Type -> Newtonsoft.Json.Serialization.JsonObjectContract
Protected Overrides Function CreateObjectContract (objectType As Type) As JsonObjectContract

Parameters

objectType
System.Type

Returns

Newtonsoft.Json.Serialization.JsonObjectContract

The Newtonsoft.Json.Serialization.JsonObjectContract for the type.

Remarks

This method is overridden in order to catch types that have System.Runtime.Serialization.DataMemberAttribute on one or more members without having a System.Runtime.Serialization.DataContractAttribute on the type itself. This used to be supported but no longer is and therefore an exception must be thrown for such types. The exception informs the developer about how to correctly attribute the type with the Newtonsoft.Json.JsonPropertyAttribute instead of the System.Runtime.Serialization.DataMemberAttribute.

Applies to