-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Consider revisiting EF.CompileQuery API #14551
Comments
@divega Would it be possible for you to bring an API proposal to the design meeting next week? |
Notes from the design meeting: We will update the signature to be more like that of EF6. Specifically, using this pattern: public static Func<TContext, TResult> CompileQuery<TContext, TResult>(
[NotNull] Expression<Func<TContext, TResult>> queryExpression) This aligns closely with the EF6 signatures, which will help with porting. Note that
This means that:
In EF6 it was possible to compose over a returned IQueryable, but it would mean that the query is executed normally, not as a compiled query. This can be a pit of failure. Decision from triage for EF Core is:
See also #15184 for considering returning |
Co-assigning to @divega so that we can discuss design in meeting when he is back from vacation.
I tried to look at EF6 code base to see how it worked.
|
Note that in final API review we decided not to change this for 3.0. |
I am re-opening this to re-consider. (Given title, it was never closed-fixed, probably won't-fix) |
See also #13483. Specifically, pre-compiled queries assume the model for a given DbContext will never change. |
See discussion in #25368 about warnings when the expression tree is not appropriate; e.g. has |
Note from triage: we discussed this again and concluded that the cost and breaking nature of this change cannot be justified for the value it would bring. |
Looking at the issue described at #14547, I realized that the way our current API plays with the type system can lead to some ambiguity and possibly confusion. For example:
I am not 100% sure what we should do, and if it is worth breaking the current API, but I see some opportunity to simplify it. One possibility is to remove the "CompileAsyncQuery" variation and return a CompiledQuery object from some/all overloads that contains methods to consume the results synchronously or asynchronously.
The text was updated successfully, but these errors were encountered: