koenbeuk / EntityFrameworkCore.Projectables

Project over properties and functions in your linq queries
MIT License
260 stars 17 forks source link

Error when calling static method with namespace qualification #85

Closed Bretttt closed 4 months ago

Bretttt commented 10 months ago

I created a static method

public static class Functions
{
    [Projectable]
    public static int Foo(int v1, int v2) => v1 + v2;
}

and an entity

public class MyEntity
{
    public int Prop1 { get; set; }
    public int Prop2 { get; set; }

    [Projectable]
    public int Projection => Functions.Foo(Prop1, Prop2);
}

Everything works fine.

However, when I qualify the method call using the namespace,

public class MyEntity
{
    public int Prop1 { get; set; }
    public int Prop2 { get; set; }

    [Projectable]
    public int Projection => My.Namespace.Functions.Foo(Prop1, Prop2);
}

It fails.

'Unable to resolve generated expression for MyEntity.Projection'

Bretttt commented 8 months ago

I found this also applies to namespace-qualified enums

koenbeuk commented 4 months ago

This is fixed with #101