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

半腔热情 提交于 2019-12-07 17:52:09

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/12094408/what-native-dotnet-data-type-is-most-appropriate-for-conveying-sql-server-hierar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!