MrDave1999 / EFCore.CustomQueryPreprocessor

A custom query expression preprocessor that plugs into the LINQ query processing pipeline of EF Core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EFCore.CustomQueryPreprocessor

Nuget-Badges

I am not the creator of the code for this repository. The only thing I did was to wrap Ivan Stoev code in a class library for reuse in other projects.

All credits to Ivan Stoev.

Read Ivan Stoev original answer: https://stackoverflow.com/a/62138200

Installation

Run the following command in the terminal if your project is using EF Core 3.1/5.0:

dotnet add package EFCore.CustomQueryPreprocessor -v 1.0.0

In case your project uses EF Core 6.0/7.0, run the following:

dotnet add package EFCore.CustomQueryPreprocessor -v 2.0.0

Usage

Call the following method in DbContext.OnConfiguring:

public class AppDbContext : DbContext
{
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.AddDelegateDecompiler();
    }
}

And don't forget to add the [Decompile] decorator on the methods you want to decompile.

About

A custom query expression preprocessor that plugs into the LINQ query processing pipeline of EF Core


Languages

Language:C# 100.0%