forked from dotnet/efcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Includes refactoring that makes it easier for providers to override behavior. Fixes dotnet#15718
- Loading branch information
Showing
5 changed files
with
103 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/EFCore.SqlServer/Query/Pipeline/SqlServerQueryableMethodTranslatingExpressionVisitor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.Metadata; | ||
using Microsoft.EntityFrameworkCore.Query.Pipeline; | ||
using Microsoft.EntityFrameworkCore.Relational.Query.Pipeline; | ||
using Microsoft.EntityFrameworkCore.Relational.Query.Pipeline.SqlExpressions; | ||
|
||
namespace Microsoft.EntityFrameworkCore.SqlServer.Query.Pipeline | ||
{ | ||
public class SqlServerQueryableMethodTranslatingExpressionVisitor : RelationalQueryableMethodTranslatingExpressionVisitor | ||
{ | ||
public SqlServerQueryableMethodTranslatingExpressionVisitor( | ||
IModel model, | ||
IQueryableMethodTranslatingExpressionVisitorFactory queryableMethodTranslatingExpressionVisitorFactory, | ||
IRelationalSqlTranslatingExpressionVisitorFactory relationalSqlTranslatingExpressionVisitorFactory, | ||
ISqlExpressionFactory sqlExpressionFactory) | ||
: base( | ||
model, | ||
queryableMethodTranslatingExpressionVisitorFactory, | ||
relationalSqlTranslatingExpressionVisitorFactory, | ||
sqlExpressionFactory) | ||
{ | ||
} | ||
|
||
protected override SqlExpression GenerateLongCountExpression() | ||
=> SqlExpressionFactory.ApplyDefaultTypeMapping( | ||
SqlExpressionFactory.Function("COUNT_BIG", new[] { SqlExpressionFactory.Fragment("*") }, typeof(long))); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...e.SqlServer/Query/Pipeline/SqlServerQueryableMethodTranslatingExpressionVisitorFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.Metadata; | ||
using Microsoft.EntityFrameworkCore.Query.Pipeline; | ||
using Microsoft.EntityFrameworkCore.Relational.Query.Pipeline; | ||
|
||
namespace Microsoft.EntityFrameworkCore.SqlServer.Query.Pipeline | ||
{ | ||
public class SqlServerQueryableMethodTranslatingExpressionVisitorFactory : IQueryableMethodTranslatingExpressionVisitorFactory | ||
{ | ||
private readonly ISqlExpressionFactory _sqlExpressionFactory; | ||
private readonly IRelationalSqlTranslatingExpressionVisitorFactory _relationalSqlTranslatingExpressionVisitorFactory; | ||
|
||
public SqlServerQueryableMethodTranslatingExpressionVisitorFactory( | ||
IRelationalSqlTranslatingExpressionVisitorFactory relationalSqlTranslatingExpressionVisitorFactory, | ||
ISqlExpressionFactory sqlExpressionFactory) | ||
{ | ||
_sqlExpressionFactory = sqlExpressionFactory; | ||
_relationalSqlTranslatingExpressionVisitorFactory = relationalSqlTranslatingExpressionVisitorFactory; | ||
} | ||
|
||
public QueryableMethodTranslatingExpressionVisitor Create(IModel model) | ||
{ | ||
return new SqlServerQueryableMethodTranslatingExpressionVisitor( | ||
model, | ||
this, | ||
_relationalSqlTranslatingExpressionVisitorFactory, | ||
_sqlExpressionFactory); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters