2

我在 EF 4.3 中尝试过,但无济于事。EF5(结合 .NET 4.5)现在支持 TVF。因此,理论上,如果以下情况可行,这个新的 EF5 功能将为我节省大量工作。

SQL查询;

SELECT O.*
FROM dbo.Orders O
INNER JOIN dbo.SecurityTVF(@Name)   S   ON  S.UserID=O.UserID

等效的 EF5 查询 - 可能吗?

using (var context = new DSN())
{
    // Return all the orders - limited by those the current user has placed
    var orders = from o in context.Orders
                 join s in context.SecurityTVF(HttpContext.Current.User.Identity.Name) on o.UserID equals s.UserID
                 select o;
}

我真的不想在这个阶段升级所有软件,除非在 EF5 中可以实现上述操作……有人试过吗?

注意:官方文档有点基础, http: //msdn.microsoft.com/en-us/data/hh859577.aspx

提前致谢!

4

1 回答 1

2

是的,可以使用 .NET 4.5、EF 5.0 和 Visual Studio 2012。

于 2012-08-30T06:36:45.953 回答