tags:

views:

163

answers:

1

I have an object with a NameValueCollection property which I'm managing with Linq2SQL. I was going to serialise it to an XML column (xelement) in the DB. My problem is I don't really have a hook to convert it to XML on save with Linq2SQL. I believe I can use the OnLoaded partial method to control the deserialisation.

Does anybody have a good method for reference types being persisted into an XML column with Linq2SQL? I don't want to have to create a new table for this property.

Thanks!

+1  A: 

I solved this by using the OnLoaded() and OnValidate() extension methods to load and serialise my reference types into an XElement object. This seems to have worked quite well and I now have a method to save a NameValueCollection to our database.

Jiyosub