-
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.
Adjusted some tests and added a fix for regression in EF Core (dotnet…
- Loading branch information
Showing
13 changed files
with
231 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
<RepositoryUrl>https://[email protected]/pawelgerr/Thinktecture.EntityFrameworkCore/_git/Thinktecture.EntityFrameworkCore</RepositoryUrl> | ||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> | ||
<RootNamespace>Thinktecture</RootNamespace> | ||
<LangVersion>8.0</LangVersion> | ||
<LangVersion>9.0</LangVersion> | ||
<Nullable>enable</Nullable> | ||
<NoWarn>$(NoWarn);CA1303</NoWarn> | ||
</PropertyGroup> | ||
|
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
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
32 changes: 32 additions & 0 deletions
32
....Relational/EntityFrameworkCore/Query/ThinktectureRelationalParameterBasedSqlProcessor.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 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.EntityFrameworkCore.Query; | ||
using Microsoft.EntityFrameworkCore.Query.SqlExpressions; | ||
|
||
namespace Thinktecture.EntityFrameworkCore.Query | ||
{ | ||
/// <summary> | ||
/// Extends <see cref="RelationalParameterBasedSqlProcessor"/>. | ||
/// </summary> | ||
public class ThinktectureRelationalParameterBasedSqlProcessor : RelationalParameterBasedSqlProcessor | ||
{ | ||
/// <inheritdoc /> | ||
public ThinktectureRelationalParameterBasedSqlProcessor( | ||
RelationalParameterBasedSqlProcessorDependencies dependencies, | ||
bool useRelationalNulls) | ||
: base(dependencies, useRelationalNulls) | ||
{ | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override SelectExpression ProcessSqlNullability(SelectExpression selectExpression, IReadOnlyDictionary<string, object> parametersValues, out bool canCache) | ||
{ | ||
if (selectExpression == null) | ||
throw new ArgumentNullException(nameof(selectExpression)); | ||
if (parametersValues == null) | ||
throw new ArgumentNullException(nameof(parametersValues)); | ||
|
||
return new ThinktectureSqlNullabilityProcessor(Dependencies, UseRelationalNulls).Process(selectExpression, parametersValues, out canCache); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...onal/EntityFrameworkCore/Query/ThinktectureRelationalParameterBasedSqlProcessorFactory.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,25 @@ | ||
using Microsoft.EntityFrameworkCore.Query; | ||
|
||
namespace Thinktecture.EntityFrameworkCore.Query | ||
{ | ||
/// <inheritdoc /> | ||
public class ThinktectureRelationalParameterBasedSqlProcessorFactory : IRelationalParameterBasedSqlProcessorFactory | ||
{ | ||
private readonly RelationalParameterBasedSqlProcessorDependencies _dependencies; | ||
|
||
/// <summary> | ||
/// Initializes new instance of <see cref="ThinktectureRelationalParameterBasedSqlProcessorFactory"/>. | ||
/// </summary> | ||
/// <param name="dependencies">Dependencies.</param> | ||
public ThinktectureRelationalParameterBasedSqlProcessorFactory(RelationalParameterBasedSqlProcessorDependencies dependencies) | ||
{ | ||
_dependencies = dependencies; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public RelationalParameterBasedSqlProcessor Create(bool useRelationalNulls) | ||
{ | ||
return new ThinktectureRelationalParameterBasedSqlProcessor(_dependencies, useRelationalNulls); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...FrameworkCore.Relational/EntityFrameworkCore/Query/ThinktectureSqlNullabilityProcessor.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,39 @@ | ||
using Microsoft.EntityFrameworkCore.Query; | ||
using Microsoft.EntityFrameworkCore.Query.SqlExpressions; | ||
using Thinktecture.EntityFrameworkCore.Query.SqlExpressions; | ||
|
||
namespace Thinktecture.EntityFrameworkCore.Query | ||
{ | ||
/// <summary> | ||
/// Extends <see cref="SqlNullabilityProcessor"/>. | ||
/// </summary> | ||
public class ThinktectureSqlNullabilityProcessor : SqlNullabilityProcessor | ||
{ | ||
/// <inheritdoc /> | ||
public ThinktectureSqlNullabilityProcessor( | ||
RelationalParameterBasedSqlProcessorDependencies dependencies, | ||
bool useRelationalNulls) | ||
: base(dependencies, useRelationalNulls) | ||
{ | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override SqlExpression VisitCustomSqlExpression(SqlExpression sqlExpression, bool allowOptimizedExpansion, out bool nullable) | ||
{ | ||
if (sqlExpression is RowNumberClauseOrderingsExpression) | ||
{ | ||
nullable = false; | ||
return sqlExpression; | ||
} | ||
|
||
if (sqlExpression is CountDistinctExpression countDistinctExpression) | ||
{ | ||
var visitedExpression = Visit(countDistinctExpression.Column, allowOptimizedExpansion, out nullable); | ||
nullable = false; | ||
return countDistinctExpression.Update(visitedExpression); | ||
} | ||
|
||
return base.VisitCustomSqlExpression(sqlExpression, allowOptimizedExpansion, out nullable); | ||
} | ||
} | ||
} |
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
...re.SqlServer/EntityFrameworkCore/Query/ThinktectureSqlServerParameterBasedSqlProcessor.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 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using Microsoft.EntityFrameworkCore.Query; | ||
using Microsoft.EntityFrameworkCore.Query.SqlExpressions; | ||
using Microsoft.EntityFrameworkCore.SqlServer.Query.Internal; | ||
|
||
namespace Thinktecture.EntityFrameworkCore.Query | ||
{ | ||
[SuppressMessage("ReSharper", "EF1001")] | ||
public class ThinktectureSqlServerParameterBasedSqlProcessor : SqlServerParameterBasedSqlProcessor | ||
{ | ||
/// <inheritdoc /> | ||
public ThinktectureSqlServerParameterBasedSqlProcessor(RelationalParameterBasedSqlProcessorDependencies dependencies, bool useRelationalNulls) | ||
: base(dependencies, useRelationalNulls) | ||
{ | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override SelectExpression ProcessSqlNullability(SelectExpression selectExpression, IReadOnlyDictionary<string, object> parametersValues, out bool canCache) | ||
{ | ||
if (selectExpression == null) | ||
throw new ArgumentNullException(nameof(selectExpression)); | ||
if (parametersValues == null) | ||
throw new ArgumentNullException(nameof(parametersValues)); | ||
|
||
return new ThinktectureSqlNullabilityProcessor(Dependencies, UseRelationalNulls).Process(selectExpression, parametersValues, out canCache); | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...erver/EntityFrameworkCore/Query/ThinktectureSqlServerParameterBasedSqlProcessorFactory.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,27 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using Microsoft.EntityFrameworkCore.Query; | ||
|
||
namespace Thinktecture.EntityFrameworkCore.Query | ||
{ | ||
/// <inheritdoc /> | ||
[SuppressMessage("ReSharper", "EF1001")] | ||
public class ThinktectureSqlServerParameterBasedSqlProcessorFactory : IRelationalParameterBasedSqlProcessorFactory | ||
{ | ||
private readonly RelationalParameterBasedSqlProcessorDependencies _dependencies; | ||
|
||
/// <summary> | ||
/// Initializes <see cref="ThinktectureSqlServerParameterBasedSqlProcessorFactory"/>. | ||
/// </summary> | ||
/// <param name="dependencies">Dependencies.</param> | ||
public ThinktectureSqlServerParameterBasedSqlProcessorFactory(RelationalParameterBasedSqlProcessorDependencies dependencies) | ||
{ | ||
_dependencies = dependencies; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public RelationalParameterBasedSqlProcessor Create(bool useRelationalNulls) | ||
{ | ||
return new ThinktectureSqlServerParameterBasedSqlProcessor(_dependencies, useRelationalNulls); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.