In a website, if I have a class:
public class Provider
{
static readonly Func<Entities, IEnumerable<Tag>> AllTags =
CompiledQuery.Compile<Entities, IEnumerable<Tag>>
(
e => e.Tags
);
public IEnumerable<Tag> GetAll()
{
using (var db = new Entities())
{
return AllTags(db).ToList();
}
}
}
在一个页面中,我有以下内容:
protected void Page_Load(object sender, EventArgs ev)
{
(new Provider()).GetAll();
}
每次页面加载时,查询将被编译多少次?在应用程序中只编译一次吗?