Silverlight:发送 List的替代方案作为 WCF RIA DomainService 方法的参数
我想创建一个接收列表(其中 T:实体)类型参数的 DomainService 方法,但似乎无法在 Silverlight 中完成(错误消息:“操作...不符合所需的签名参数类型必须是实体或复杂类型、复杂类型的集合或预定义的可序列化类型之一。”)
有哪些替代方案? 谢谢。
I want to create a DomainService method that receives a List (where T: Entity) kind of an argument, but it seems this cannot be done in Silverlight (Error message : "operation ... does not conform to the required signature. Parameter types must be an entity or complex type, a collection of complex types, or one of the predefined serializable types.")
What are the alternatives?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需传递一个 T[] 数组,它应该修复它,并且它更“正确”,因为没有理由向列表添加元素。
Just pass a T[] array, it should fix it and it is more "proper" as there's no reason to add elements to the list.
在客户端将
List
序列化为string
,然后在服务器上反序列化。我使用 DataContractSerializer 完成了此操作,效果非常好。
WCF RIA Services Contrib 还能够导入和导出一组实体,并具有额外的优势。
http://riaservicescontrib.codeplex.com
Serialize the
List<T>
to astring
in the client and then deserialize it on the server.I did this with the
DataContractSerializer
and it works great.WCF RIA Services Contrib also has the ability to Import and Export a collection of entities with added benefits.
http://riaservicescontrib.codeplex.com