Condividi tramite


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);
protected override Newtonsoft.Json.Serialization.JsonObjectContract CreateObjectContract (Type type);
override this.CreateObjectContract : Type -> Newtonsoft.Json.Serialization.JsonObjectContract
override this.CreateObjectContract : Type -> Newtonsoft.Json.Serialization.JsonObjectContract
Protected Overrides Function CreateObjectContract (objectType As Type) As JsonObjectContract
Protected Overrides Function CreateObjectContract (type As Type) As JsonObjectContract

Parameters

objectTypetype
Type

The type for which to return a Newtonsoft.Json.Serialization.JsonObjectContract.

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.

Applies to