Bug when filtering on a PathEdge with a MethodCallExpression

Posts   
 
    
Jez
User
Posts: 198
Joined: 01-May-2006
# Posted on: 19-Mar-2008 21:55:57   

Hi Frans

I ran into this problem when implementing filtering support into my lambda-based prefetch syntax.

This query against northwind:


LinqMetaData meta = new LinqMetaData(adapter);
    var query = from c in meta.Customer select c;
    query = query.WithPath(new PathEdge<OrderEntity>(CustomerEntity.PrefetchPathOrder, o => o.ShipName.EndsWith("hevalier")));


Produces this error in QueryExpressionBuilder.HandlePathEdgeExpression:

System.InvalidCastException: Unable to cast object of type 'System.Linq.Expressions.MethodCallExpression' to type 'SD.LLBLGen.Pro.LinqSupportClasses.ExpressionClasses.FilterExpression'.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 19-Mar-2008 22:33:50   

Ok, sounds like a missing coerce to filter call somewhere, will check it out simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 20-Mar-2008 16:38:46   

Error is caused by the fact that the lambda isn't handled in the preprocessor. (the pathedge's elements aren't handled till the last phase). Will correct that.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 20-Mar-2008 16:45:39   

Ok fixed it. I'll attach a new build for you so you can check if your Withpath code still works.

Frans Bouma | Lead developer LLBLGen Pro