You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
System.Xml.Linq.XElement cannot be used as a parameter value at Dapper #427
System.NotSupportedException: The member TagXML of type System.Xml.Linq.XElement cannot be used as a parameter value
at Dapper.SqlMapper.LookupDbType(Type type, String name, Boolean demand, ITypeHandler& handler)
Why this error coming? How I can use XML type of inputs in StoredProcedure.?
Good question. You can probably pass a string instead. I agree it would be
nice if we supported at least one of XmlDocument / XDocument (or element),
but that probably requires some code changes. Shouldn't be anything huge,
though.
now one of my sp having input parameter as Db type XML
Now i am executing sp like
var param = new DynamicParameters();
paramAdd("@TagXML",
stringIsNullOrEmpty(studentTagXML)?null:XElementParse(studentTagXML));
paramAdd("@CustomTagXML", stringIsNullOrEmpty(studentCustomTagXML) ? null
: XElementParse(studentCustomTagXML));
paramAdd("@returnhttps://github.com/Return", strRet, direction:
ParameterDirectionOutput);
paramAdd("@RetunErrMsg", strRetMsg, direction: ParameterDirectionOutput);
using (var connection = new SqlConnection(ConnectionString))
{
if (connectionState != ConnectionStateOpen)
{
connectionOpen();
}
connectionExecute("My Sp here", param, commandType:
CommandTypeStoredProcedure);
}
This code giving me error:
SystemNotSupportedException: The member TagXML of type
SystemXmlLinqXElement cannot be used as a parameter value
at DapperSqlMapperLookupDbType(Type type, String name, Boolean demand,
ITypeHandler& handler)
Why this error coming? How I can use XML type of inputs in StoredProcedure?
—
Reply to this email directly or view it on GitHub #427.
I haven't looked at this yet, but if it means a new dependency in CoreCLR world - I'm not totally sure it's worth having in the base package. It may not be an problem at all, just noting the potential issue here.
Note: both XDocument and XmlDocument are in 23509, but yeah, I kinda agree
with you. But at the same time: our dependency tree on core-clr is also
long enough that it may be a moot point to get excited about
On 24 Dec 2015 9:24 p.m., "Nick Craver" [email protected] wrote:
I haven't looked at this yet, but if it means a new dependency in CoreCLR
world - I'm not totally sure it's worth having in the base package. It may
not be an problem at all, just noting the potential issue here.
—
Reply to this email directly or view it on GitHub #427 (comment)
.
Just like to add my 2 cents: I think it would be nice if the XML data type in SQL Server could be deserialized by Dapper into an XmlDocument or XDocument field in a .NET POCO, as well as a string (which seems to be all that is currently supported). It would be more semantically correct.
Activity
mgravell commentedon Dec 24, 2015
Good question. You can probably pass a string instead. I agree it would be
nice if we supported at least one of XmlDocument / XDocument (or element),
but that probably requires some code changes. Shouldn't be anything huge,
though.
On Thu, 24 Dec 2015 12:01 dalvirsaini [email protected] wrote:
dalvirsaini commentedon Dec 24, 2015
Thanks for reply.
By passing xml as string now exception changes to :
So in which version I can expect that XElement will be supported. Any time estimation?
Thanks
NickCraver commentedon Dec 24, 2015
I haven't looked at this yet, but if it means a new dependency in CoreCLR world - I'm not totally sure it's worth having in the base package. It may not be an problem at all, just noting the potential issue here.
mgravell commentedon Dec 24, 2015
Note: both XDocument and XmlDocument are in 23509, but yeah, I kinda agree
with you. But at the same time: our dependency tree on core-clr is also
long enough that it may be a moot point to get excited about
On 24 Dec 2015 9:24 p.m., "Nick Craver" [email protected] wrote:
jez9999 commentedon Mar 1, 2016
Just like to add my 2 cents: I think it would be nice if the XML data type in SQL Server could be deserialized by Dapper into an
XmlDocumentorXDocumentfield in a .NET POCO, as well as a string (which seems to be all that is currently supported). It would be more semantically correct.Support xml types by default (XmlDocument, XDocument, XElement) - fix D…