WCF数据合同/序列化 [英] WCF Data Contract / Serialization

查看:77
本文介绍了WCF数据合同/序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个简单的WCF应用程序,该应用程序公开了一个操作.此操作将复合数据类型作为参数.

I created a simple WCF application which expose one operation. This operation takes a composite data type as parameter.

我尚未使用[DataContract]属性修饰此复合数据类型.但这是可行的,我可以在WSDL中看到此模式.

I have not decorated this composite data type with [DataContract] attribute. But this is working and I can see the Schema for this in WSDL.

现在我的理解是,应该使用[Serializable]或[dataContract]属性修饰这种新的自定义类型,以参与Web服务操作.

Now my understanding is that this new custom type should be decorated with [Serializable] or [dataContract] attribute to take part in the Web services operation.

我在这里想念什么?

推荐答案

POCO支持,并且您

POCO support have been introduced in WCF since .NET 3.5 SP1 and you no longer need to decorate your objects with [DataContract] and [DataMember] attributes. Public properties will be automatically exposed. Although I would recommend you explicitly marking them with those attributes.

这篇关于WCF数据合同/序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆