DataContract IsReference =真返回空对象 [英] DataContract IsReference=true returning empty objects

查看:574
本文介绍了DataContract IsReference =真返回空对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我用的是CyclicReferencesAwareAttribute属性(http://chabster.blogspot.com/2008/02/wcf-cyclic-references-support.html)来解决循环引用WCF服务。不过现在我想用Silverlight客户端使用相同的服务。接收数据时效果很好Silverlight客户端上使用此方法,但是CyclicReferencesAwareAttribute属性不会对Silverlight的一边时,我想再次发送的对象。

I have a WCF service with cyclic references that I was using the CyclicReferencesAwareAttribute attribute (http://chabster.blogspot.com/2008/02/wcf-cyclic-references-support.html) to solve. However now I want to use the same service with a Silverlight client. Receiving data works well on the Silverlight client with this method, however the CyclicReferencesAwareAttribute attribute does not work on the Silverlight side when I want to send objects back again.

我已经改变使用哪个应该避开这个问题的数据合同的IsReference财产。然而现在返回的对象是空的! (所有字段是默认或空)。这是在我的ASP.NET客户(原件)和我的Silverlight客户端一样的。

I have changed to use the IsReference property on the data contract which is supposed to get round with this issue. However now the objects that are returned are empty! (All fields are either default or null). This is the same in my ASP.NET client (original) and my Silverlight client.

拥有在任何人命中的问题?这里是属性。
[System.Runtime.Serialization.DataContract(命名空间=htt​​p://testnamespace.co.uk/entities,IsReference = TRUE)]

Has anyone hit is issue before? Here is the attribute. [System.Runtime.Serialization.DataContract(Namespace="http://testnamespace.co.uk/entities", IsReference=true)]

推荐答案

1 - 确保所有的属性有System.Runtime.Serialization.DataMember属性。

1- Make sure that all the properties have the System.Runtime.Serialization.DataMember attribute.

2 - 确保了需要转移所有属性有一个公共的getter和setter

2- Make sure that all properties that need to be transfered have a public getter and setter

这篇关于DataContract IsReference =真返回空对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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