Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What native dotNet data type is most appropriate for conveying SQL Server hierarchyId values?

Specifically we have a SQL Server stored procedure that accepts a hierarchyId as a parameter, and typically we have a SOAP layer on our stored procs that allows them to be called via SOAP.

The SOAP services are implemented using the [WebMethod] attribute on C# methods, and these methods are defined using native dotNet types that typically map well to SQL server types.

At this time I am not sure what data type to use in the C# WebMethod to accept a hierarchyId. Perhaps I should use a hierarchy path string of the form '/1/2/3' and a function to parse this into a SqlHierarchyId that can be passed to a stored procedure.

like image 530
redcalx Avatar asked Jan 22 '26 05:01

redcalx


1 Answers

Use a string and parse it using SqlHierarchyId.Parse()

like image 99
redcalx Avatar answered Jan 24 '26 20:01

redcalx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!