In an SQL 2014 database I have a stored procedure which uses XML as a parameter.
I'm attempting to create a Codefluent Method that will use XML as a parameter type. The parameter is defined:
<cf:parameter typeName="xml" name="XMLcriteria " />
This results in the DB procedure having the parameter defined as:
@XMLcriteria [nvarchar] (256)
instead of the expected:
@XMLcriteria as XML
If I attempt to increase the Maximum size of the parameter, I get an even stranger result:
@XMLcriteria [nvarchar] (max) = ''
How can I pass XML as Method parameters such that the parameter is defined as XML in the stored procedure created by the SQL producer?
I'm also having trouble understanding just what the XML CF type does. If I create a CF entity property with a type of XML, the BOM produces a class property of type String. If I assign an xElement or xDocument to this property, all of the XML markup is stripped away and I end up with just one long string of values. This being the case, when I use this Entity (which should contain XML properties) as a parameter in an SQL procedure, I get the one long string with no way to select elements.
To define an XML parameter, you can use the attribute cfps:dataType="xml"
:
<cf:parameter typeName="xml" cfps:dataType="xml" name="arg" />
If you need a property of type XmlElement
or XmlDocument
, you can add a partial class and add a property that parses the value of the string property.