QueryInterceptor.EntityFrameworkCore
2.0.10
See the version list below for details.
dotnet add package QueryInterceptor.EntityFrameworkCore --version 2.0.10
NuGet\Install-Package QueryInterceptor.EntityFrameworkCore -Version 2.0.10
<PackageReference Include="QueryInterceptor.EntityFrameworkCore" Version="2.0.10" />
<PackageVersion Include="QueryInterceptor.EntityFrameworkCore" Version="2.0.10" />
<PackageReference Include="QueryInterceptor.EntityFrameworkCore" />
paket add QueryInterceptor.EntityFrameworkCore --version 2.0.10
#r "nuget: QueryInterceptor.EntityFrameworkCore, 2.0.10"
#addin nuget:?package=QueryInterceptor.EntityFrameworkCore&version=2.0.10
#tool nuget:?package=QueryInterceptor.EntityFrameworkCore&version=2.0.10
QueryInterceptor.Core
The problem
Normally when you're trying to modify expression trees you need to write an expression visitor. When trying to plug your expression visitor into an IQuerable's expression tree, you need to write a linq provider (yikes).
Implementation based on http://stackoverflow.com/questions/1839901/how-to-wrap-entity-framework-to-intercept-the-linq-expression-just-before-executi
The solution
QueryInterceptor introduces one extension method on IQueryable<T>
(InterceptWith
) that lets you plug in arbitrary expression visitors.
namespace QueryInterceptor
{
public static class QueryableExtensions
{
public static IQueryable<T> InterceptWith<T>(this IQueryable<T> source, params ExpressionVisitor[] visitors);
}
}
Basic Example
The example below uses an expression visitor that changes == to != anywhere in the expression tree.
public class EqualsToNotEqualsVisitor : ExpressionVisitor
{
protected override Expression VisitBinary(BinaryExpression node)
{
if (node.NodeType == ExpressionType.Equal)
{
// Change == to !=
return Expression.NotEqual(node.Left, node.Right);
}
return base.VisitBinary(node);
}
}
class Program
{
static void Main(string[] args)
{
var query = from n in Enumerable.Range(0, 10).AsQueryable()
where n % 2 == 0
select n;
// Print even numbers
foreach (var item in query)
{
Console.WriteLine(item);
}
Console.WriteLine();
// Print odd numbers
var visitor = new EqualsToNotEqualsVisitor();
foreach (var item in query.InterceptWith(visitor))
{
Console.WriteLine(item);
}
}
}
Sponsors
Entity Framework Extensions and Dapper Plus are major sponsors and proud to contribute to the development of QueryInterceptor.Core.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.3.0)
- Microsoft.EntityFrameworkCore (>= 2.3.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on QueryInterceptor.EntityFrameworkCore:
Package | Downloads |
---|---|
Generics.Specifications.EntityFramework
Entity Framework hook for Generics.Specifications. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
8.0.10 | 137 | 6/22/2025 |
8.0.9 | 3,901 | 11/23/2023 |
7.0.10 | 129 | 6/22/2025 |
7.0.9 | 431 | 11/23/2023 |
7.0.8 | 7,863 | 2/22/2023 |
6.0.10 | 130 | 6/22/2025 |
6.0.9 | 145 | 11/23/2023 |
6.0.8 | 305 | 2/22/2023 |
2.0.10 | 135 | 6/22/2025 |
2.0.9 | 148 | 11/23/2023 |
2.0.8 | 302 | 2/22/2023 |
1.0.10 | 130 | 6/22/2025 |
1.0.9 | 155 | 11/23/2023 |
1.0.8 | 300 | 2/22/2023 |
1.0.7 | 9,455 | 12/1/2018 |
1.0.1 | 1,581 | 11/5/2017 |
1.0.0 | 1,160 | 11/2/2017 |
See releasenotes