MobileServiceContractResolver.CreateObjectContract 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);
Parameters
objectType
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 DataMemberAttribute on one or more members without having a 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 DataMemberAttribute.