hazzik / DelegateDecompiler

A library which is able to decompile a delegate or a method body to its lambda representation
MIT License
522 stars 62 forks source link

Automatically decompile using a IDbContextOptionsExtension like LinqKit does? #184

Closed bzbetty closed 1 month ago

bzbetty commented 1 year ago

Linqkit lets you register an EF extension so that they don't need the manual Decompile() like call for each query. I think something like that would be theoretically possible with Delegate Decompiler too?

builder
    .UseSqlServer(connectionString)
    .WithExpressionExpanding();

reference: https://github.com/scottksmith95/LINQKit/blob/master/src/LinqKit.Microsoft.EntityFrameworkCore/ExpandableDbContextOptionsExtension.cs

hazzik commented 1 year ago

Thanks for suggestion. I'll think about this. Meanwhile. Pull requests are welcomed.

hazzik commented 1 year ago

I've done some preliminary work. Unfortunately a new package for EF Core 6 would be required as there are some incompatible changes that I cannot make compatible between both EF Core 5 and EF Core 6.

powermetal63 commented 1 year ago

@hazzik You can take a look at this SO answer https://stackoverflow.com/a/62138200/5202563, and especially the update for EF Core 7.0, since now thanks to the added Linq query expression interception mechanism all you need is few lines of code.