Closed cyril265 closed 1 year ago
For reference: The relevant generated expression tree of using a method group contains a call to CreateDelegate
instead of a call to an actual method.
.Call .Constant<System.Reflection.MethodInfo>(Entity Transform(Entity)).CreateDelegate(
.Constant<System.Type>(System.Func`2[EntityFrameworkCore.Projectables.FunctionalTests.MethodGroupTests+Entity,EntityFrameworkCore.Projectables.FunctionalTests.MethodGroupTests+Entity]),
.Constant<EntityFrameworkCore.Projectables.FunctionalTests.MethodGroupTests>(EntityFrameworkCore.Projectables.FunctionalTests.MethodGroupTests))
We will have to update ProjectableExpressionReplacer.cs
to understand a call to CreateDelegate
and replace it with the generated expression.
Closed by #87
Hey, awesome library. I just replaced LinqKit with it 😃
There might be an issue with method groups inside projectables. If you do the following inside a Projectable it fails because method groups are converted to Func<> instead of Expression<> :
Error message:
So it's kind of a C#/EF limitation but it might be worth rewritting Projectables that use method groups. Also Rider for example offers a quick fix to replace calls with method group. Which makes it even more confusing/error prone.