XML data type in EF 4.1 Code First
问题 I would like to use SQL Server xml type as a column type for an entity class. According to this thread it's possible to map such a column to string type: public class XmlEntity { public int Id { get; set; } [Column(TypeName="xml")] public string XmlValue { get; set; } } The table is correctly generated in the datebase by this definition. New XmlEntity objects are also can be created. But then I try to get some entity from the database: var entity = db.XmlEntities.Where(e => e.Id == 1)