title: How to serialize and save an object to database as Xml using Linq to SQL
body: <p>I were using  FileStream to Serialize an Object to Xml and Save to the disk</p>
  
  <pre><code>Stream str = new FileStream(@"serializedstate.xml", FileMode.OpenOrCreate)
  XmlSerializer x = new XmlSerializer(typeof(GridState));
  x.Serialize(str, new GridState
          {
              GridName= txtGridName.Text,
              GridColumns = GetGridColumnStates()
          });
  </code></pre>
  
  <p>This works fine and Xml file is generated on disk. How do I save serialized Object as Xml into a Sql Server 2008 database's XML column using Linq to SQL? And how to deserialize the same from database?</p>