交叉申请在Linq [英] Cross apply in Linq

查看:60
本文介绍了交叉申请在Linq的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将SQL Server 2008 CROSS APPLY与LINQ-2-SQL一起使用?

Is it possible to use SQL Server 2008 CROSS APPLY with LINQ-2-SQL?

示例SQL:

select d.dateCol, tvf.descr, tvf.value
from dateTable d
cross apply tvFunction(d.dt, 'anotherParam') tvf
where d.category='someCat'

CROSS APPLY允许使用表(示例中的dateTable)中的值作为tablevalue函数的参数.如果需要对一系列输入进行复杂的计算(封装在表值函数中),这将非常有用.

CROSS APPLY enables using values from a table (dateTable in the example) as parameters to a tablevalue function. This is very usefull if you need do do a complex calculation (encapsulated in a table value function) for a range of inputs.

推荐答案

使用它的唯一方法是将上述代码包装在存储过程中,并使用LINQ to SQL进行包装.

The only way to use it would be to wrap the above code in a stored procedure and wrap it with LINQ to SQL.

这篇关于交叉申请在Linq的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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