<p>I'd like to serialize some LINQ generated objects and store them in a table as a binary field (Never you mind why). I'd like to be able to write some code that looks something like this:</p>

<pre><code>SerialTestDataContext db = new SerialTestDataContext();

relation_table row = db.relation_tables.First();

MemoryStream memStream = new MemoryStream();
BinaryFormatter bin = new BinaryFormatter();
bin.Serialize(memStream, row);
Console.WriteLine("Serilized successfully");

TestTable tt = new testTable();
tt.data = new System.Data.Linq.Binary(memStream.ToArray());
db.testTables.InsertOnSubmit(tt);
db.SubmitChanges();
Console.WriteLine("Inserted successfully");
</code></pre>

<p>Currently that fails even though I've marked the generated classes as [Serializable] because one of the LINQ inherited classes is not. Is it even possible to do this?</p>

Linq classes are partial classes.  You can change the definition to mark the classes as implementing
ISerializable
and then provide the code...
```
```
public partial class User : ISerializable
{
  // implement GetObjectData here
}
```
```
There might still be issues with deserialization, however (I'm not 100% on this).  An alternative is to use xml serialization and implement
IXmlSerializable
, which has methods for serializing and deserializing, allowing you to control the entire process...