LINQ与存储过程和用户​​定义的表类型参数SQL [英] LINQ to SQL with stored procedures and user defined table type parameter

查看:141
本文介绍了LINQ与存储过程和用户​​定义的表类型参数SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用LINQ与SQL Server 2008中存储过程SQL除了一个问题,一切都很好地工作。 L2S无法生成与用户定义的表类型作为参数存储过程的方法。在DBML设计面板使用对象参数类型,而不是表类型
法的签名,当我试图编译我得到了错误:

I am using LINQ to SQL with stored procedures in SQL Server 2008. Everything work well except one problem. L2S cannot generate the method for the stored procedure with user defined table type as parameter. Method signature in dbml design panel use object for parameter type instead of table type and when I tried to compile I got error:

Error: DBML1005: Mapping between DbType 'Structured' and
Type 'System.Object' in Parameter 'ParaName' of Function 'dbo.StoredProcName'
is not supported. 



有没有办法来解决这个这个问题的?我不想回到传统的ADO.NET数据访问。

Is there a way to work around this of this problem? I don't want to go back to traditional ADO.NET data access.

推荐答案

我不认为有什么可用的右现在 - 表值参数在SQL Server 2008中引入 - 后LINQ和LINQ2SQL出炉了。

I don't think there's anything available right now - table-valued parameters were introduced in SQL Server 2008 - after LINQ and LINQ2SQL were out already.

我还没有发现任何提及任何博客文章有关的LINQ2SQL在.NET 4.0中,到目前为止表值参数的支持。

I haven't found any mention in any of the blog post about support for table-valued parameters in LINQ2SQL in .NET 4.0 so far.

更新:结果
这里有一个的博客文章达米安卫队的修复和改进LINQ到SQL在.NET 4.0的时间框架。

UPDATE:
Here's a blog post by Damien Guard on the fixes and improvement for Linq-to-SQL in the .NET 4.0 time frame.

更新2:结果
不幸的是,根据达,此功能不支持.NET 3.5,并且将不支持在.NET 4.0中任一: - (

UPDATE 2:
Unfortunately, according to Damien, this feature isn't supported in .NET 3.5, and will not be supported in .NET 4.0 either :-(

不能在3.5完成或4.0,现在结果
:( [)amien

这篇关于LINQ与存储过程和用户​​定义的表类型参数SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆