Error on nested model #145
Closed
masoodinfo
started this conversation in
General
Replies: 1 comment 1 reply
-
Hi @masoodinfo, Can you also share your models? if it is something like this it should work out of the box! var maper = new GridifyMapper<Post>(true);
maper.AddMap("categori", q => q.PostInCategories.Select(q => q.Category.Onvan ));
var query = new GridifyQuery(1, 10, "categori=*روزنامه", "");
var expression = query.GetFilteringExpression(maper);
// expression: q => ((q.PostInCategories != null) AndAlso q.PostInCategories.Any(q => q.Category.Onvan.Contains("روزنامه")))
public class Post
{
public List<PostInCategories> PostInCategories {get;set;}
}
public class PostInCategories
{
public Category Category {get;set;}
}
public class Category
{
public string Onvan {get;set;}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
i use .net core 7.0.14 & last version of gridify
i write maper :
error :
System.ArgumentException: Expression of type 'System.String' cannot be used for return type 'System.Boolean'
at System.Linq.Expressions.Expression.ValidateLambdaArgs(Type delegateType, Expression& body, ReadOnlyCollection
1 parameters, String paramName) at System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body, String name, Boolean tailCall, IEnumerable
1 parameters)at System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body, Boolean tailCall, IEnumerable
1 parameters) at Gridify.QueryBuilders.LinqQueryBuilder
1.GenerateNestedExpression(Expression body, IGMap1 gMap, ValueExpressionSyntax value, SyntaxNode op) at Gridify.QueryBuilders.LinqQueryBuilder
1.BuildNestedQuery(Expression body, IGMap1 gMap, ValueExpressionSyntax value, SyntaxNode op) at Gridify.QueryBuilders.BaseQueryBuilder
2.ConvertBinaryExpressionSyntaxToQuery(BinaryExpressionSyntax binarySyntax)at Gridify.QueryBuilders.BaseQueryBuilder
2.BuildQuery(ExpressionSyntax expression, Boolean isParenthesisOpen) at Gridify.QueryBuilders.BaseQueryBuilder
2.Build(ExpressionSyntax expression)at Gridify.GridifyExtensions.ApplyFiltering[T](IQueryable
1 query, String filter, IGridifyMapper
1 mapper)at Gridify.GridifyExtensions.ApplyFiltering[T](IQueryable
1 query, IGridifyFiltering gridifyFiltering, IGridifyMapper
1 mapper)at Gridify.GridifyExtensions.GridifyQueryable[T](IQueryable
1 query, IGridifyQuery gridifyQuery, IGridifyMapper
1 mapper)at Gridify.GridifyExtensions.Gridify[T](IQueryable
1 query, IGridifyQuery gridifyQuery, IGridifyMapper
1 mapper)Beta Was this translation helpful? Give feedback.
All reactions