WCF 代理始终显示数组而不是 List
我在 Visual studio 2010 sp1 中使用 WSSF,但遇到 WCF 集合问题。似乎当我创建服务引用并更改高级设置以使用通用列表而不是数组时。尝试使用集合时我仍然得到数组。每当我想添加或删除对象时,我都必须将数组来回转换为列表。
有谁知道为什么?或者我需要改变什么才能让它正常工作。在数据契约设计器中,我有两种类型的集合。一种是“数据契约集合”,另一种是“原始数据类型集合”。
任何帮助表示赞赏。
I'm using WSSF in Visual studio 2010 sp1 and I'm having an issue with WCF collections. It seems that when I create a service reference and change the advanced setting to use a Generic list instead of an array. I still get arrays when trying to use the collections. I would have to convert the array back and forth to a list whenever i want to add or remove objects.
Does anyone know why? or what i need to change for it to work ok. In the data contract designer, i have two types of collections. One is a "Data Contract Collection", another one is "Primitive Data Type Collection".
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有使用过 WSSF,但在基础级别上,WCF IList 被作为数组处理。您必须手动将 DTO 序列化为列表。也许这就是幕后发生的事情?
I haven't used WSSF but at a base level WCF ILists are handled as arrays. You would have to manually serialise the DTO as a List. Perhaps that's what's happening underneath the covers?