SortDescriptor PropertyName is not case sensitive

If my model has 2 element same named with different cases even different types, I get an exception as below
public DateTime DateCreated { get; set; }
public string datecreated { get; set; }

System.Reflection.AmbiguousMatchExceptionAmbiguous match found.

  at System.RuntimeType.GetPropertyImpl (System.String name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Type returnType, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) [0x00061] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Type.GetProperty (System.String name, System.Reflection.BindingFlags bindingAttr) [0x0000e] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Linq.Expressions.Expression.PropertyOrField (System.Linq.Expressions.Expression expression, System.String propertyOrFieldName) [0x00011] in <65f4a23934a3468fae9abe3139b55169>:0 
  at Syncfusion.DataSource.Extensions.QueryableExtensions.GetValueExpression (System.Linq.Expressions.ParameterExpression parameterExpression, System.String propertyName, System.Type sourceType) [0x00044] in <5f6edfc74e4b4229808ea2056b326ca2>:0 
  at Syncfusion.DataSource.Extensions.QueryableExtensions.GetLambdaWithComplexPropertyNullCheck (System.Linq.IQueryable source, System.String propertyName, System.Linq.Expressions.ParameterExpression parameterExpression, System.Type sourceType) [0x000ff] in <5f6edfc74e4b4229808ea2056b326ca2>:0 
  at Syncfusion.DataSource.Extensions.QueryableExtensions.OrderByDescending (System.Linq.IQueryable source, System.String propertyName, System.Type sourceType) [0x00021] in <5f6edfc74e4b4229808ea2056b326ca2>:0 
  at Syncfusion.DataSource.DataSource.SortQueryable (System.Linq.IQueryable source) [0x00121] in <5f6edfc74e4b4229808ea2056b326ca2>:0 

1 Reply

MK Muthu Kumaran Gnanavinayagam Syncfusion Team January 8, 2018 02:22 PM UTC

Hi Emil, 
 
We have checked the reported query “Exception thrown when binding similar PropertyName in Model class bound to SortDescriptor property” from our side. We want to inform you that this the actual behavior of SortDescriptor and GroupDescriptor which enables them to bind only unique property names. The reported exception will be thrown, even when the return type of each property differs and this in turn helps to modify the PropertyName based on the usage of the properties bound to the SortDescriptor. 
 
Please let us know if you require further assistance. 
 
Regards, 
G.Muthu kumaran. 


Loader.
Up arrow icon