This is a migrated thread and some comments may be shown as answers.

Generated dynamic linq expressions cause all fieldnnames to start with 'it'

1 Answer 18 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 10 Aug 2015, 09:16 PM

I am using RadFilter on a page connected to a RadGrid in the simplest way.  The RadGrid built in filter generates a correct filterexpression for use in dynamic linq.  However the RadFilter gets everything correct except for the fact that the field names are prefixed with "it."  

I also decompiled the RadFilter and related code and came across the following code in which it appears that the "it" prefix is very intentional and also very hard-coded.  This is forcing me to put in an event handler to search for the prepended 'it' and remove it.  What is happening here?

 

:

public string FormatFieldName(string fieldName, Type dataType, bool isCaseSensitive)
{
dataType = RadFilterTypeHelper.GetNonNullableType(dataType);
if (dataType == typeof (string))
{
string str = isCaseSensitive ? "" : ".ToUpper()";
return string.Format("iif(it.{0}==null,\"\",it.{0}).ToString(){1}", (object) fieldName, (object) str);
}
if (!(dataType == typeof (char)))
return string.Format("it.{0}", (object) fieldName);
string str1 = isCaseSensitive ? "" : ".ToUpper()";
return string.Format("Char(iif(it.{0}==null,'''',it.{0})).ToString(){1}", (object) fieldName, (object) str1);
}

1 Answer, 1 is accepted

Sort by
0
Charles
Top achievements
Rank 1
answered on 12 Aug 2015, 05:21 PM
Nevermind, I found another error in my code that was preventing the filter from being applied.  Though I can't find documentation for the dlinq syntax, apparently the "it." prefix is meaningful and works just fine.  The resulting query is correct.
Tags
Filter
Asked by
Charles
Top achievements
Rank 1
Answers by
Charles
Top achievements
Rank 1
Share this question
or