什么原生的dotNet数据类型是最合适的用于输送的SQL Server HIERARCHYID值?最合适、数据类型、dotNet、HIERARCHYID

2023-09-04 04:08:28 作者:云卷莓

具体来说,我们必须接受一个HIERARCHYID作为参数的SQL Server存储过程,通常我们对我们存储的特效一个SOAP层,使他们能够通过SOAP调用。

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.

在SOAP服务所使用的C#方法[WebMethod]属性来实现,这些方法是使用原生的dotNet类型,通常很好地映射到SQL服务器类型定义。

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.

在这个时候,我不知道用在C#中的WebMethod的数据类型接受HIERARCHYID。也许我应该使用的形式'/ 1/2/3'和功能的层次结构路径字符串解析它变成 SqlHierarchyId 可以传递给存储过程。

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.

推荐答案

使用一个字符串,并使用解析它 SqlHierarchyId.Parse()

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

 
精彩推荐
图片推荐