Support Nullable type?

Oct 15, 2009 at 2:46 PM

We use flee in our project. In our project, we have expressions with variables of nullable datatype. We get error when using flee to evaluate such expressions. For example, for expression (dtReportDate >= DateTime.Parse("2008-11-01")), dtReportDate is a variable of type DateTime?(nullable datetime). When using flee to evaluate it, it reported error: Unhandled Exception: Ciloci.Flee.ExpressionCompileException: CompareElement: Operation 'GreaterThanOrEqual' is not defined for types 'Nullable'1' and 'DateTime'. Yet C# compiler has no problem to compile such nullable type.

Is there a way to fix the parser in flee to solve this issue?

Jun 1, 2011 at 8:49 PM

I had the same issue today but I was able to make a change to the MemberElement class.  Go to the GetMemebers function and change

the return statement:

Return MyPrevious.TargetType.FindMembers(targets, BindFlags, MyOptions.MemberFilter, MyName)

TO:

If Nullable.GetUnderlyingType(MyPrevious.TargetType) IsNot Nothing Then

  Return Nullable.GetUnderlyingType(MyPrevious.TargetType).FindMembers(targets, BindFlags, MyOptions.MemberFilter, MyName)

Else

 Return MyPrevious.TargetType.FindMembers(targets, BindFlags, MyOptions.MemberFilter, MyName)

End If



 

Good Luck.



 

Jan 3, 2013 at 12:43 PM

The solution posted by spboyer doesn't seem to be working correctly for System.DateTime? (nullable System.DateTime).

Jul 29, 2014 at 3:58 PM
This doesn't seem to work for me either. Has anyone found another way?