EF CTP4 CompiledQuery [英] EF CTP4 CompiledQuery

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

问题描述

我在使用DbContext创建LINQ表达式时遇到问题。 CTP4中不支持System.Data.Objects.CompiledQuery.Compile()吗?

I'm having trouble creating LINQ expression using the DbContext. Is System.Data.Objects.CompiledQuery.Compile() not supported in CTP4?


    private static readonly Expression<Func<DbContext, string, User>> expression = (database, name) => database.Users.SingleOrDefault(user => user.Username == name);
    private static readonly Func<DbContext, string, User> plainQuery = expression.Compile();
    private static readonly Func<DbContext, string, User> compiledQuery = CompiledQuery.Compile(expression);

推荐答案

您好,

已编译的查询不适用于CTP4。我们希望在我们点击RTM时可以做更自动的事情并避免你必须明确地编译和缓存查询,如果这没有及时添加那么我们将向现有公开一个类似的选项
已编译的查询。

Compiled queries are not available in CTP4. We’re hoping we can do something more automatic by the time we hit RTM and avoid you having to explicitly compile and cache queries, if this doesn’t get added in time then we will expose a similar option to the existing compiled queries.

~Rowan


这篇关于EF CTP4 CompiledQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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