简体   繁体   English

实体集序列化-WCF,C#,VS2008

[英]EntitySet serialization - WCF, C#, VS2008

I asked this earlier and followed Marc's advise. 我早先问了这个,并听了Marc的建议。 That did not help me. 那没有帮助我。

link text 连结文字

My client object is what I want to serialize but with Employee entity set, with any serialization, I get my object serialized without any reference to my EntitySets. 我的客户端对象是我要序列化的对象,但是使用Employee实体集进行任何序列化,我都可以序列化对象,而无需任何对EntitySet的引用。

Anyone successfully serialized such objects? 有人成功序列化了此类对象吗?

Based on the info in the link, it looks like you are trying to serialise an IQueryable object. 根据链接中的信息,您似乎正在尝试序列化IQueryable对象。

I don't think that this is possible, it looses it's meaning when it goes out of scope of the db connection. 我认为这是不可能的,当它超出数据库连接范围时,就失去了它的含义。 Which it will when you go over a WCF hop. 当您经过WCF跃点时将使用哪一个。

What you can do is to pull the data out using a ToArray on your IQueryable object. 您可以做的是使用IQueryable对象上的ToArray提取数据。 That result will be serializable over WCF. 该结果将可通过WCF序列化。

Hope this helps 希望这可以帮助

Shiraz 设拉子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM