-
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
Allow FromSql on IQueryable<T> #18720
Comments
@smitpatel This seems to work correctly in 2.2. That is, an IQueryable that is not a DbSet can have FromSql used on it and the results we get back still honor the Include. If FromSql was allowed on IQueryable, would this work with the 3.0 query pipeline? |
Yes, it will work. I believe, when adding the restriction on DbSet, we explicitly decided that user would have to specify FromSql before Include. Are we changing it? |
@smitpatel No decision to change it yet; we will discuss. |
Discussed in triage and given that |
@ajcvickers Then should it also be disallowed to use |
That is a bug which would go away when fixing #18903 |
Discussed in triage and, as Smit says, we will handle this as part of #18903. |
EF Core 3.0 made a change to remove
FromSql
onIQueryable<T>
and replace it withFromSql*
methods onDbSet<T>
itself, so it's no longer composable. Why is this no longer supported?My use case was:
I was overriding ASP.NET Core's
UserStore
like this:to make sure that the
UserProfiles
collection ofApplicationUser
is always included, because we are using it everywhere we're usingApplicationUser
itself.In a controller, we implemented search manually using SQL because EF Core did a poor job translating the LINQ we attempted to write:
Now with EF Core 3.0, I can't use the
UserManager
abstraction anymore and i'm forced to drill down to theDbContext
to get theDbSet
itself and copy theInclude
here. This seems like a regression 😕The text was updated successfully, but these errors were encountered: