Skip to content

Is Enum filtering supported #31

@ghost

Description

Hi, I'm currently feeling a bit dumb as I can't get filtering with enums to work.

I'm trying to filter with the ordinal / int value of the enum, however, it fails to map the int to the corresponding enum value:

2023-07-10 08:13:35.3869|ERROR|MYPROJECT.Common.ErrorLogHandler.Helpers.LoggerService|System.InvalidOperationException: The binary operator Equal is not defined for the types 'MYPROJECT.API.DataAccess.DB.Enums.EUserRole' and 'System.Int32'.
   at System.Linq.Expressions.Expression.GetEqualityComparisonOperator(ExpressionType binaryType, String opName, Expression left, Expression right, Boolean liftToNull)
   at System.Linq.Expressions.Expression.Equal(Expression left, Expression right, Boolean liftToNull, MethodInfo method)
   at DynamicExpresso.Parsing.Parser.GenerateEqual(Expression left, Expression right)
   at DynamicExpresso.Parsing.Parser.ParseComparison()
   at DynamicExpresso.Parsing.Parser.ParseLogicalAnd()
   at DynamicExpresso.Parsing.Parser.ParseLogicalXor()
   at DynamicExpresso.Parsing.Parser.ParseLogicalOr()
   at DynamicExpresso.Parsing.Parser.ParseConditionalAnd()
   at DynamicExpresso.Parsing.Parser.ParseConditionalOr()
   at DynamicExpresso.Parsing.Parser.ParseConditional()
   at DynamicExpresso.Parsing.Parser.ParseAssignment()
   at DynamicExpresso.Parsing.Parser.ParseExpressionSegment()
   at DynamicExpresso.Parsing.Parser.ParseParenExpression()
   at DynamicExpresso.Parsing.Parser.ParsePrimaryStart()
   at DynamicExpresso.Parsing.Parser.ParsePrimary()
   at DynamicExpresso.Parsing.Parser.ParseUnary()
   at DynamicExpresso.Parsing.Parser.ParseMultiplicative()
   at DynamicExpresso.Parsing.Parser.ParseAdditive()
   at DynamicExpresso.Parsing.Parser.ParseTypeTesting()
   at DynamicExpresso.Parsing.Parser.ParseComparison()
   at DynamicExpresso.Parsing.Parser.ParseLogicalAnd()
   at DynamicExpresso.Parsing.Parser.ParseLogicalXor()
   at DynamicExpresso.Parsing.Parser.ParseLogicalOr()
   at DynamicExpresso.Parsing.Parser.ParseConditionalAnd()
   at DynamicExpresso.Parsing.Parser.ParseConditionalOr()
   at DynamicExpresso.Parsing.Parser.ParseConditional()
   at DynamicExpresso.Parsing.Parser.ParseAssignment()
   at DynamicExpresso.Parsing.Parser.ParseExpressionSegment()
   at DynamicExpresso.Parsing.Parser.ParseExpressionSegment(Type returnType)
   at DynamicExpresso.Parsing.Parser.Parse()
   at DynamicExpresso.Parsing.Parser.Parse(ParserArguments arguments)
   at DynamicExpresso.Interpreter.ParseAsLambda(String expressionText, Type expressionType, Parameter[] parameters)
   at DynamicExpresso.Interpreter.ParseAs[TDelegate](String expressionText, String[] parametersNames)
   at DynamicExpresso.Interpreter.ParseAsExpression[TDelegate](String expressionText, String[] parametersNames)
   at Fop.Extensions.ApplyFop[T](IQueryable`1 source, IFopRequest request)
   at MYPROJECT.API.BusinessLogic.Services.UserService.PaginateUser(IFopQuery searchQuery, IQueryable`1 query) in C:\Path\To\Project\api\MYPROJECT.API.BusinessLogic\Services\UserService.cs:line 332
   at MYPROJECT.API.BusinessLogic.Services.UserService.GetAllUsersAsync(IFopQuery searchQuery) in C:\Path\To\Project\api\MYPROJECT.API.BusinessLogic\Services\UserService.cs:line 132
   at MYPROJECT.API.Controllers.UserController.GetAllUser(SearchFilterQuery searchQuery) in C:\Path\To\Project\api\MYPROJECT.API\Controllers\UserController.cs:line 43

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions