-
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
Query: Number is written into SQL Command Text instead of being a parameter when using 'this' #12224
Comments
@Wain123 So |
|
@ajcvickers Yes, So, I expect it to behave the same as the following code: var a = this;
ctx.Blogs.Where(b => b != a).Count(); Which means it would translate to: SELECT COUNT(*)
FROM "BLOGS" "b"
WHERE "b"."SEQNR" <> :a_0_Seqnr The only difference would be that the constant ID value is in a parameter instead of the command text, which is usually a good idea (at least, I think there's a reason why you do that for most queries). The reason why I expect this is because of this example: public class Foo {
public Action f() {
return () => Console.WriteLine(this);
}
} I can write |
We discussed this at length in triage and decided that as of now we will leave this behavior as is. While this is a case where parameterizing makes sense it is a very limited and unusual scenario and it is not clear that in general parameterizing constants from the expression tree is desirable. Also, the ultimate behavior will be the same and the workarounds to allow this parameterization (for example, using key comparisons directly) are not unreasonable. Finally, special casing this adds complexity to query and increases the test matrix, which is something that we want to avoid in the query pipeline. If we hear more cases like this, then we may reconsider this decision. |
Gets translated to:
EF Core version: 2.1.0-rc1-30677
Database Provider: Microsoft.EntityFrameworkCore.Oracle
Operating system: Windows 10
IDE: Visual Studio Professional 2017 15.6.5
The text was updated successfully, but these errors were encountered: