CallbackBehaviorAttribute.IgnoreExtensionDataObject 属性
定义
获取或设置一个值,该值指定是否将未知序列化数据发送到网络上。Gets or sets a value that specifies whether to send unknown serialization data onto the wire.
public:
property bool IgnoreExtensionDataObject { bool get(); void set(bool value); };
public bool IgnoreExtensionDataObject { get; set; }
member this.IgnoreExtensionDataObject : bool with get, set
Public Property IgnoreExtensionDataObject As Boolean
属性值
如果永不发送未知序列化数据,则为 true;否则为 false。true if unknown serialization data is never sent; otherwise, false. 默认值为 false。The default is false.
注解
如果某个类型实现 IExtensibleDataObject 接口,则该接口就会存储在反序列化到该类型时通过网络传入的所有未知额外数据。If a type implements the IExtensibleDataObject interface, it stores any extra data it does not know about that comes over the wire when deserializing into that type. 例如,如果 Person 类型具有 FirstName 和 LastName 成员,且有一个名为 PhoneNumber 的元素进入,则系统会存储该元素。For example, if a type Person has members FirstName and LastName, and an element called PhoneNumber comes in, it is stored. 在以后序列化该类型时,会重新发出 PhoneNumber。When later serializing the type, PhoneNumber is re-emitted. 问题在于 Person ,该服务所导出的架构只具有 FirstName 和 LastName ,因此 Windows Communication Foundation (WCF) 会生成一个架构无效的实例。The problem is that the schema for Person exported by that service only has FirstName and LastName, so Windows Communication Foundation (WCF) generates a schema-invalid instance. 如果一定要严格遵从架构,则可以将 IgnoreExtensionDataObject 设置为 true,以关闭此重新发出行为。If strict schema compliance is important, you can set IgnoreExtensionDataObject to true to turn this re-emitting behavior off.
无论设置如何 IgnoreExtensionDataObject ,WCF 都始终处理 (传入和传出的已知数据) 并且当有额外的数据时不引发异常。Regardless of the IgnoreExtensionDataObject setting, WCF always processes known data (both in and out) and does not throw exceptions when extra data comes in.
您可以使用 < callbackDebug > 元素在客户端应用程序配置文件中设置此属性。You can use the <callbackDebug> element to set this property in a client application configuration file.