Linq-to-Sql not detecting change in xml
- by porum
I have an xml field (Answers) in Sql Server, but when changing the content via Linq-to-Sql, the record is not flagged for updating. e.g. in Linqpad...
var profile = Profiles.FirstOrDefault(p => p.Answers != null);
profile.Answers.SetAttributeValue("date", DateTime.Now.ToString());
GetChangeSet().Dump(); // nothing flagged
profile.Answers = new XElement(profile.Answers); // ends up with correct xml
GetChangeSet().Dump(); // record is flagged as changed
Any suggestions apart from assigning a clone of itself to the field or storing the xml as a string to force the update?