Question

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();
        }
    }
}

In a page I have:

protected void Page_Load(object sender, EventArgs ev)
{
    (new Provider()).GetAll();
}

How many times the query will be compiled? Every time the page loads...? Once in the application...?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top