Search code examples
asp.netlinq-to-sqlentityset

Serialize EntitySet through net remoting


I have a shared object through net remoting. The problem is that this object has some EntitySet and EntityRef attributes. When I try to run the program I get an exception telling me that EntitySet is not marked as Serializable. If I mark it as Serializable everything seems to be ok, but when I try to access from outsied to the attribute represented by the EntitySet, I am not able to use it.

Any suggestion will be appreciated.

Thanks in advance.

BTW, Does anyone know how change the default binary serialization of tcp channel?


Solution

  • I have finally reached the solution, let me explain:

    In LinqToSQL for registering a relationship between two tables (for example 1:M) you have to declare an EntitySet on the M side and an EntityRef on the other one.

    In my case I have a private attribute which stands for the EntitySet, and a public accessor for modifying it. Considering Linq to Sql needs explicit decoration serialization through DataContract (for classes) and DataMember (for attributes) the problem was that I decorated the public attribute but not the private one.

    After that everything rocks! (I have lost many hours, but I have learned a lot of Serialization)