0

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 closed: 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?

Shersh
  • 1
  • UPDATE: I changed serilixation mode to Unidirectional and it works, but have next problem, for one of object some properties was not defined with DataMemberAttribute and a not see it in client... How i can solve it? – Shersh Apr 17 '11 at 09:27
  • Marc_s, how can i add this attribute if code is generated by visual studio ? – Shersh Apr 17 '11 at 12:47
  • You could use an alternative method to generate your classes, which supports that kind of thing - e.g. [Damien Guard's Linq-to-SQL T4 templates (free)](http://l2st4.codeplex.com/) or [CodeSmith's PLinqO framework](http://www.codesmithtools.com/product/frameworks) (which requires a license of CodeSmith to use) – marc_s Apr 17 '11 at 13:39
  • But basically, if you have the `SerializationMode = Unidirectional` the built-in Linq-to-SQL designer should do this, too, automatically. Maybe you need to delete that table from your model and re-add it again so that it'll pick up that `[DataMember]` attribute... – marc_s Apr 17 '11 at 13:43

1 Answers1

0

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).
David Wick
  • 7,055
  • 2
  • 36
  • 38
  • Yes, inner excption exist, stacktrace of inner exception: at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) – Shersh Apr 17 '11 at 08:55
  • I thout about simple objects... but it so hard to map all objects, and i think it's silly do it when i have ADO.NET... – Shersh Apr 17 '11 at 08:56
  • http://automapper.codeplex.com/ or http://valueinjecter.codeplex.com/ make life easier – David Wick Apr 17 '11 at 09:47