views:

50

answers:

3

Hi Everyone,

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?

A: 

Try to mark the individual attributes and properties as serializable as well, this should get you access to those properties as well.

a note is all events on the Set also need to be serialized.

Gnostus
thanks. That was the first thing I did. I decorated EntitySet with either [NonSerialize()] and Serializate options. The problem is that all classes involved in the class that you are trying to serialize have to be serializable aswell. EntitySet heritates from a lot of Interfaces which makes it complicated to serialize an attribute of that type.
Francisco
A: 

I think that the thing goes over here: http://msdn.microsoft.com/en-us/library/bb546184.aspx

There is an example which deals with EntitySet and serialization.

Francisco
Another clue in the way of finding the path:"Q. When I try to serialize, I get the following error: "Type 'System.Data.Linq.ChangeTracker+StandardChangeTracker' ... is not marked as serializable."A. Code generation in LINQ to SQL supports DataContractSerializer serialization. It does not support XmlSerializer or BinaryFormatter. For more information, see Serialization (LINQ to SQL)." from:http://msdn.microsoft.com/en-us/library/bb386929.aspx
Francisco
A: 

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)

Francisco