Skip to content

Support parameters defined outside of CachingQuery closure in compiled query execution #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
denisbredikhin opened this issue Mar 18, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@denisbredikhin
Copy link

With Query.Execute you can executed compiled query (so it should not be translated next time). You can also execute IQueryable using it, but you can't execute IQueryable constructed in other class.
So this works:

[Test]
public void TestSimpleQueryable()
{
  var name = "some_name";
  var ents = Query.All<Enterprise>().Where(q => q.Name== name);
  Assert.AreEqual(0, Query.Execute(() => ents.Count()));
}

But this doesn't:

private static class QueryableProvider
{
  public static IQueryable<Enterprise> GetEnterprisesByName(string name)
  {
    return Query.All<Enterprise>().Where(q => q.Name==name);
  }
}

[Test]
public void TestGeneratedQueryable()
{
  var name = "some_name";
  var ents = QueryableProvider.GetEnterprisesByName(name);
  Assert.AreEqual(0, Query.Execute(() => ents.Count()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants