Skip to content
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

Cosmos: remove automatic composition of discriminator filter in raw SQL queries #26292

Merged
merged 1 commit into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/EFCore.Cosmos/Query/Internal/QuerySqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,10 @@ protected override Expression VisitSelect(SelectExpression selectExpression)
}

Visit(selectExpression.FromExpression);
_sqlBuilder.AppendLine();

if (selectExpression.Predicate != null)
{
_sqlBuilder.Append("WHERE ");
_sqlBuilder.AppendLine().Append("WHERE ");
Visit(selectExpression.Predicate);
}

Expand Down
7 changes: 1 addition & 6 deletions src/EFCore.Cosmos/Query/Internal/SqlExpressionFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -525,12 +525,7 @@ public virtual SelectExpression Select(IEntityType entityType)
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual SelectExpression Select(IEntityType entityType, string sql, Expression argument)
{
var selectExpression = new SelectExpression(entityType, sql, argument);
AddDiscriminator(selectExpression, entityType);

return selectExpression;
}
=> new(entityType, sql, argument);

private void AddDiscriminator(SelectExpression selectExpression, IEntityType entityType)
{
Expand Down
Loading