-
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
Basic FromSql() support in new pipeline #15752
Conversation
src/EFCore.Relational/Extensions/RelationalQueryableExtensions.cs
Outdated
Show resolved
Hide resolved
test/EFCore.Relational.Specification.Tests/Query/FromSqlQueryTestBase.cs
Outdated
Show resolved
Hide resolved
test/EFCore.Relational.Specification.Tests/Query/FromSqlQueryTestBase.cs
Outdated
Show resolved
Hide resolved
test/EFCore.SqlServer.FunctionalTests/Query/FromSqlQuerySqlServerTest.cs
Outdated
Show resolved
Hide resolved
Expression.Constant(sql.Format), | ||
Expression.Constant(sql.GetArguments()))); | ||
} | ||
|
||
internal static IQueryable<TEntity> FromSqlBackingMethod<TEntity>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason this method is internal rather than private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just so that we can do nameof()
on it to identify it (see here).
src/EFCore.Relational/Extensions/RelationalQueryableExtensions.cs
Outdated
Show resolved
Hide resolved
src/EFCore.Relational/Extensions/RelationalQueryableExtensions.cs
Outdated
Show resolved
Hide resolved
test/EFCore.SqlServer.FunctionalTests/SqlServerComplianceTest.cs
Outdated
Show resolved
Hide resolved
@smitpatel addressed your comments, AFAIK we're now waiting only for @divega's sign-off on the exception message. |
Microsoft.EntityFrameworkCore.SqliteComplianceTest.All_test_bases_must_be_implemented [FAIL] |
@smitpatel sorry for the runaround, async tests should now be fully enabled and passing. |
@divega ping, we need your sign-off on the new exception message @smitpatel anything remaining? If not can you approve? |
Rebased on latest master and squashed |
src/EFCore.Relational/Query/Pipeline/SqlExpressions/FromSqlExpression.cs
Outdated
Show resolved
Hide resolved
6ab73ff
to
244613b
Compare
* Parameterization not implemented (see dotnet#15750) * FromSqlRaw() and FromSqlInterpolated() are now defined over DbSet<>, not IQueryable<>. FromSql() is still defined over IQueryable<> but throws if not directly on a DbSet<>. Closes dotnet#15704
Ugh, just updated to Preview 8 and this broke me pretty horribly. Why is
Did I do something wrong earlier, cause it seemed to work fine with |
Yes, it had both meaning and added value. It used to work fine 🤦♂ I guess I'll have to find a way to build up the query in a different order then... |
@khellang - If you have valid use case then please file a new issue with details why you need to apply FromSql on something other than query root. |
@khellang To add to what @smitpatel said, this could be something we revisit if we have misunderstood how it is valuable, but time is running short to make changes, so the sooner you can give us the feedback the more chance it will be actionable., |
I managed to work around it by breaking a couple of APIs in my library. I get that the old APIs made it easier to shoot yourself in the foot, but it just seemed like a totally unnecessary change for something that already worked fine. I guess that's just part of the pain of moving to new major versions 😔 |
Worked fine for some cases, but not for all. It is entirely true that for your case it was fine. But there were cases in which people actually tried to use it incorrectly and "shot" themselves in the foot. |
not IQueryable<>. FromSql() is still defined over IQueryable<> but
throws if not directly on a DbSet<>.
Closes #15704
(rebased and pushed last minute before boarding a plane, it may be somewhat broken :))