【问题标题】:EntityRef and compiled LINQ plansEntityRef 和编译的 LINQ 计划
【发布时间】:2011-03-21 05:31:31
【问题描述】:

有什么方法可以强制 LINQ-2-SQL 为EntityRef 编译和缓存计划。

通过内部分析,我们看到大量 CPU 用于继续重新编译计划。

System.Reflection.Emit.DynamicMethod.CreateDelegate System.Data.Linq.SqlClient.ObjectReaderCompiler.Compile System.Data.Linq.SqlClient.SqlProvider.GetReaderFactory System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Compile System.Data.Linq.CommonDataServices+DeferredSourceFactory`1.ExecuteKeyQuery System.Data.Linq.CommonDataServices+DeferredSourceFactory`1.Execute System.Linq.Enumerable.SingleOrDefault System.Data.Linq.EntityRef`1.get_Entity

我更喜欢使用实体引用,但我想如果别无选择,我们可以手动编写代码。

【问题讨论】:

    标签: c# linq linq-to-sql


    【解决方案1】:

    不,没有办法强制 LINQ 2 SQL 编译和缓存 EntityRef 或 EntitySet 的查询。

    在实现中没有钩子。

    如果您需要使用CompiledQuery,您必须编写自己的包装器和助手。

    【讨论】:

      猜你喜欢
      • 2011-03-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-22
      • 2016-12-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多