hazzik / DelegateDecompiler

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

Can the type of the computer property be an Interface? #127

Closed paulvanbladel closed 1 year ago

paulvanbladel commented 6 years ago

I have following use case. An Order type which has a computed property "OrderStatus" of type IOrderStatus:

 [Computed]
 [NotMapped]
        public IOrderStatus OrderStatus
        {
            get
            {
                return (_orderStatus == "Draft") ? (IOrderStatus)(new Draft()) : (IOrderStatus)(new Ordered());
            }
        }

Now I want to query as follows:

 var result = _context.Orders
                  .Where(c => c.OrderStatus is Draft)
                  .Decompile()
                  .ToList();

When NOT using .Decompile I get the correct results but the query is done locally (that's why I'm using DelegateDecompiler :) )

but with .Decompile() I get as error: : 'Argument types do not match'

Any idea?

magicmoux commented 6 years ago

Could you please provide a more complete code example for tests and potential fix ?

Thanks, Max.

hazzik commented 1 year ago

Duplicate of #107

hazzik commented 1 year ago

This has been released in 0.32.0. Please consider ❤️ supporting the project.