你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
MobileServiceContractResolver.CreateObjectContract(Type) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
创建一个 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 正确确定类型的属性。
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈