Home  /  Questions  /  Question

50   50
Apr 19, 2014

SqlMap & Xml (Spark Generator)

I am trying to Generate an entity in my database that contains an Xml column. When I run the Generator I am told that the Xml object does not exist and that I may be missing a using statement.

I know that there is a System.Xml namespace but I don't know if an object of type Xml exists.

Should I try and use the SqlXml type, will this work?

Any suggestions?


50   50
Apr 20, 2014
Managed to resolve this by updating the SqlMap in the generator to map XML to string

508   99.9
Apr 22, 2014

Indeed, the solution is to map Xml to string and it will work fine. 
The next release of Spark code generator will  replace Xml with the string data type (for those who need this now, it is the very last entry in the SqlMap).

Alternatively, you could bypass Spark and optimize your CRUD with XmlSqlReader etc,  but  his involves extra hand-coding.  For those interested here is a link:  http://stackoverflow.com/questions/13690991/what-does-the-sql-server-xml-datatype-translate-to-in-net-and-how-do-i-convert