Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PredicateBuilder failed on EF Core 5.x #118

Closed
mannok opened this issue Jun 25, 2020 · 4 comments
Closed

PredicateBuilder failed on EF Core 5.x #118

mannok opened this issue Jun 25, 2020 · 4 comments
Assignees
Labels

Comments

@mannok
Copy link

mannok commented Jun 25, 2020

Steps to reproduce

Please see the codes below

public string[] FindAssets()
{
    string[] result;

    using (var ctx = new StockContext())
    {
        var predicate = PredicateBuilder.New<Asset>().Or(asset => asset.Symbol.Contains("TSLA"));

        result = ctx.Assets.AsExpandable()
        .Where(predicate)
        .Select(z => z.Symbol)
        .ToArray();
    }

    return result;
}

When the code start exec at result = , it throws

Exception: Unhandled expression type: 'Extension'
LinqKit.ExpressionVisitor.Visit(Expression exp)
LinqKit.ExpressionVisitor.VisitExpressionList(ReadOnlyCollection<Expression> original)
LinqKit.ExpressionVisitor.VisitMethodCall(MethodCallExpression m)
LinqKit.ExpressionVisitor.Visit(Expression exp)
LinqKit.Extensions.Expand(Expression expr)
LinqKit.ExpandableQueryProvider<T>.System.Linq.IQueryProvider.CreateQuery<TElement>(Expression expression)
System.Linq.Queryable.Where<TSource>(IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)

Further technical details

EF Core version: 5.0.0-preview.4.20220.10
Database provider: Microsoft.EntityFrameworkCore.SqlServer 5.0.0-preview.4.20220.10
Target framework: netcoreapp3.1
Operating system: Windows 10
IDE: Visual Studio 2019

@StefH
Copy link
Collaborator

StefH commented Jun 25, 2020

#116

@StefH StefH added the bug label Jun 25, 2020
@StefH
Copy link
Collaborator

StefH commented Jul 16, 2020

@mannok
Copy link
Author

mannok commented Jul 21, 2020

@StefH
Copy link
Collaborator

StefH commented Jul 21, 2020

I'll release LinqKit.Microsoft.EntityFrameworkCore version 5.0.0-preview.6 in some time.

(I keep the same preview version as the one which is used by https://www.nuget.org/packages/Microsoft.EntityFrameworkCore/5.0.0-preview.6.20312.4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants