gpt4 book ai didi

c# - LINQ to SQL 和编译查询

转载 作者:太空宇宙 更新时间:2023-11-03 11:40:40 26 4
gpt4 key购买 nike

我有一个返回 IQueryable<tblMyTable> 的编译查询.如果我执行编译查询,结果是否缓存在我传递的 DataContext 中?

using(context)
{
var count = MyCompiledQuery(context).Count();

//Does the call to MyCompiledQuery execute against the database again, or does it go to the context for results?
var first10 = MyCompiledQuery(context).Take(10);
}

这是一个使用 C# 的 .NET 3.5 应用程序。

最佳答案

是的,再次执行查询。您可以通过与您的应用并行运行 SQL Profiler 来查看它。

关于c# - LINQ to SQL 和编译查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4891019/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com