开发者

TypeBuilder with DataContract and DataMembers

开发者 https://www.devze.com 2023-02-05 01:03 出处:网络
I\'m generating a dynamic type on the fly with a DataContract attribute and DataMembers. I\'ve verified the type is getting generated correctly with DataContract and DataMember attributes using reflec

I'm generating a dynamic type on the fly with a DataContract attribute and DataMembers. I've verified the type is getting generated correctly with DataContract and DataMember attributes using reflection on the generated type.开发者_运维技巧

I then generate a ServiceContract type on the fly that includes operation with said types.

However, when I add a ServiceReference from the client, my DataContract types get generated with the client with no properties/DataMembers.

Any idea what's going wrong here?

Thanks.


Answer Here:

http://www.netframeworkdev.com/windows-communication-foundation/datacontractserializer-not-serializingdeserializing-type-built-with-typebuilder-65973.shtml

My TypeBuilder properties' methods were marked with MethodAttributes.Virtual.

Another great well documented feature of the DataContractSerializer.

0

精彩评论

暂无评论...
验证码 换一张
取 消