Open KarthikKarunanithy opened 4 years ago
Hi, have you found the solution for this?
I have the same issue.
Hi , Yes, In FilterBuilder.cs I had to change the method ProcessListStatement.. below for reference
if(propType.IsArray)
{
type = propType.GetElementType();
}
else
{
type = propType.GetGenericArguments()[0];
}
On Wed, 11 Nov 2020 at 14:16, Justinus Hermawan notifications@github.com wrote:
Hi, have you found the solution for this?
I have the same issue.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dbelmont/ExpressionBuilder/issues/64#issuecomment-725447320, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJAWQ4LUAIHWVPYZM54WZ5TSPKMCLANCNFSM4LHHNTBA .
-- Regards, Karthik P K
Hi, thank you. I just tried it but with no luck.
I modified some in the ProcessListStatement()
method:
...
var propType = param.Type.GetProperty(basePropertyName).PropertyType;
var type = propType.IsArray ? propType.GetElementType() : propType.GetGenericArguments()[0];
...
My test case:
var indexes = new Dictionary<long, Index>();
indexes.Add(1, new Index { Position = 1000, Values = new object[3] { "Welly", "Chandra", 26 } });
indexes.Add(2, new Index { Position = 1001, Values = new object[3] { "Darma", "Angelo", 25 } });
indexes.Add(3, new Index { Position = 1002, Values = new object[3] { "Abby", "Yeremia", 28 } });
indexes.Add(4, new Index { Position = 1003, Values = new object[3] { "Yonathan", "Gunawan", 22 } });
indexes.Add(5, new Index { Position = 1004, Values = new object[3] { "Aldy", "Santoso", 24 } });
var filter = new Filter<Index>();
filter.By("Values[1]", Operation.EqualTo, "Chandra", Connector.Or);
filter.By("Values[2]", Operation.EqualTo, 28);
public class Index
{
public long Position { get; set; }
public object[] Values { get; set; }
}
Error message:
System.ArgumentException: '1' is not a member of type 'System.Object' (Parameter 'propertyOrFieldName')
Hi, I have just started to look into your library and it look and the test cases are helpful. I have a class object with array eg: Contact[] Contacts. Your library only supports IList and in GetExpression it throws an out of bounds exception in ProcessListStatement at var type param.Type.GetProperty(basePropertyName).PropertyType.GetGenericArguments()[0];
Can you please let me know if there is a different way to handle this?