什么原生的dotNet数据类型最适合传输SQL Server分级值?

时间:2021-04-09 17:02:24

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.

具体来说,我们有一个SQL Server存储过程,它接受一个层次结构作为参数,通常我们在存储的proc上有一个SOAP层,允许通过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.

SOAP服务是使用c#方法上的[WebMethod]属性实现的,这些方法是使用通常映射到SQL服务器类型的本地dotNet类型定义的。

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.

此时,我不确定在c# WebMethod中使用什么数据类型来接受一个分级id。也许我应该使用'/1/2/3'表单的层次结构路径字符串和一个函数将其解析为可以传递给存储过程的SqlHierarchyId。

1 个解决方案

#1


5  

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

使用字符串并使用sqlhierarchy yid . parse()解析它

#1


5  

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

使用字符串并使用sqlhierarchy yid . parse()解析它