Skip to content

Commit

Permalink
Get rid of EmptyQueryCompiler
Browse files Browse the repository at this point in the history
  • Loading branch information
axelheer committed Jan 8, 2025
1 parent c79e15d commit c075df7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 23 deletions.
2 changes: 1 addition & 1 deletion build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<AnalysisMode>All</AnalysisMode>
<LangVersion>13.0</LangVersion>
<Nullable>Enable</Nullable>
<VersionPrefix>7.2.0</VersionPrefix>
<VersionPrefix>7.3.0</VersionPrefix>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
Expand Down
2 changes: 1 addition & 1 deletion pack.props
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ To support different LINQ implementations, the following flavours are available.
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>http://nein.tech/nein-linq</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>Added support for EF Core 9.</PackageReleaseNotes>
<PackageReleaseNotes>Fixed usage of EF Core 9 on .NET 8.</PackageReleaseNotes>
<PackageTags>LINQ;EF;IX</PackageTags>
</PropertyGroup>

Expand Down
21 changes: 1 addition & 20 deletions src/NeinLinq.EntityFrameworkCore/EntityQueryProviderAdapter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Query.Internal;

namespace NeinLinq;
Expand All @@ -12,7 +11,7 @@ internal sealed class EntityQueryProviderAdapter : EntityQueryProvider
public ExpressionVisitor Rewriter => provider.Rewriter;

public EntityQueryProviderAdapter(RewriteEntityQueryProvider provider)
: base(new EmptyQueryCompiler())
: base(null!)
{
this.provider = provider;
}
Expand All @@ -31,24 +30,6 @@ public override object Execute(Expression expression)

public override TResult ExecuteAsync<TResult>(Expression expression, CancellationToken cancellationToken = default)
=> provider.ExecuteAsync<TResult>(expression, cancellationToken);

private sealed class EmptyQueryCompiler : IQueryCompiler
{
public Func<QueryContext, TResult> CreateCompiledAsyncQuery<TResult>(Expression query)
=> throw new NotSupportedException();

public Func<QueryContext, TResult> CreateCompiledQuery<TResult>(Expression query)
=> throw new NotSupportedException();

public TResult Execute<TResult>(Expression query)
=> throw new NotSupportedException();

public TResult ExecuteAsync<TResult>(Expression query, CancellationToken cancellationToken)
=> throw new NotSupportedException();

public Expression<Func<QueryContext, TResult>> PrecompileQuery<TResult>(Expression query, bool async)
=> throw new NotSupportedException();
}
}

#pragma warning restore EF1001
3 changes: 3 additions & 0 deletions test/.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ dotnet_diagnostic.CA1852.severity = none

# Do not directly await a Task
dotnet_diagnostic.CA2007.severity = none

# xUnit CancellationTokens
dotnet_diagnostic.xUnit1051.severity = none
1 change: 0 additions & 1 deletion test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<PropertyGroup>
<DefaultNamespace>NeinLinq.Tests</DefaultNamespace>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<NoWarn>$(NoWarn);xUnit1051</NoWarn>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down

0 comments on commit c075df7

Please sign in to comment.