你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

MobileServiceContractResolver.CreateObjectContract(Type) 方法

定义

创建一个 Newtonsoft.Json.Serialization.JsonObjectContract,它提供与给定类型应如何序列化到 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

参数

objectTypetype
Type

要将 Newtonsoft.Json.Serialization.JsonObjectContract 返回到的类型。

返回

Newtonsoft.Json.Serialization.JsonObjectContract

类型的 Newtonsoft.Json.Serialization.JsonObjectContract

注解

此方法被重写,以便捕获在一个或多个成员上具有 DataMemberAttribute 但在类型本身上没有 DataContractAttribute 的类型。 此方法在过去是支持的,但现在已不再支持,因此,对于此类类型必须引发异常。 该异常通知开发人员如何使用 Newtonsoft.Json.JsonPropertyAttribute 而不是 DataMemberAttribute 正确确定类型的属性。

适用于