-
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
QueryTypes: binding error for query using defining query with navigation and query filter on top of that #11792
Comments
Also consider scenario in #12763 |
just hitting this myself. Based on my own tests, these scenarios are not supported when the defining query has navigations but they are fine (succeed and translate things like Where and FirstOrDefault into the SQL) when the DQ does not cintain any navigations. I just want to confirm that I'm not missing some other case before I share this info. Thanks and good finds @andriysavin! 👍 |
I am still getting this exception (Value cannot be null. Parameter name: tableExpression) in preview 3 of 2.2 (2.2.0-preview3-35497).
Then this is the query that fails |
There's two ways I was able to get past this:
Example: ** in your DbContext public DbQuery<SomeClass> SomeClasses {get;set;} ** in OnModelCreating builder.Query<SomeClass>().ToQuery(() => Enumerable.Empty<SomeClass>().AsQueryable()); ** in calling class, assuming _context is your DbContext public IQueryable<SomeClass> SomeClasses => _context.SomeClasses.FromSql(/* insert raw sql statement with join */ );
Example: builder.Query<SomeClass>().ToQuery(() =>
SomeDbSet
.Where(x=>x.SomeValue == "something")
.AsQueryable()
.Select(result=> new SomeClass { SomeProperty = result.SomeDbSetValue })); Doing either of these, I'm able to reference the query and issue conditional statements that translate to a SQL statement properly. |
Assigning to @maumar since he is working on query filters (and defining queries) |
Not needed as per #18903 |
Repro:
QM:
exception:
The text was updated successfully, but these errors were encountered: