Facing new challenges everyday

What you must avoid in LINQ to SQL one to many associations

December 8th, 2008

Last saturday I spent few hours trying to figure out the reason of a very annoying bug that was happening with my WCF Service, for several times if got the same error: “The underlying connection was closed: The connection was closed unexpectedly.”.

The root cause of this bug was a LINQ to SQL query in my WCF service that was retuning a large list of objects, I tried to set maxItemsInObjectGraph of dataContractSerializer, but with no success. My LINQ model contains some onetomany associations that was generating both child and parent properties, this setting was causing the generation of infinite number of object references in my LINQ resultset, after disabling the generation of child property of all onetomany associations the error gone.

Post to Twitter

No Comments »

No comments yet.

Leave a comment

:mrgreen: :neutral: :twisted: :shock: :smile: :???: :cool: :evil: :grin: :oops: :razz: :roll: :wink: :cry: :eek: :lol: :mad: :sad:
Imagem CAPTCHA

RSS feed for these comments. | TrackBack URI

Visitors Around the World

Polls

How Is My Site?

View Results

Loading ... Loading ...

Categories

Meta

Links

hosted by easy2use.net