开发者

WCF + sending linq generated objects

i have entities generated from my .dbml. So some objects have relationship "one to many" and in entities it was generated as EntitySet.

Also, I have WCF Workflow Service Application which contains .xamlx with bussines logic.

So using this .xamlx i try to send objects which was genereted before to client, but i catch an exception "The underlying connection was close开发者_StackOverflow中文版d: The connection was closed unexpectedly".

EntitySet<> was added to KnonwTypes. Serelzation mode in .dbml file has "None" value.

So, could you tell me how i can solve this problem?


is there an inner exception?

my guess is an circular reference caused by the navigation properties.

if that's that case you have a couple of options:

  • remove the virtual keyword from your navigation properties and eager load everything. Note: not sure if this applies to linq to sql.
  • map your entities to simple dto objects.
  • employ a circular reference aware serializer (the one built in to .net is not).
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜