I'm populating the datagrid using the LoadData event and Dynamic Linq:
var queryItems = _auditLogService.Query();
if (!string.IsNullOrEmpty(query.Filter)) {
queryItems = queryItems.Where(query.Filter);
}
if (!string.IsNullOrEmpty(query.OrderBy)) {
queryItems = queryItems.OrderBy(query.OrderBy);
} else {
queryItems = queryItems.OrderBy(o => o.Id);
}
count = queryItems.Count();
if (query.Skip.HasValue) {
queryItems = queryItems.Skip(query.Skip.Value);
}
if (query.Top.HasValue) {
queryItems = queryItems.Take(query.Top.Value);
}
However, the generated LoadDataArgs event parameter has incorrect filter syntax for Guids.
The generated filter for Guids is:
Id == fd9417ba-ce5c-43d1-b2a9-0048d9bec44b
However, applying that using Dynamic Linq gives the error:
System.Linq.Dynamic.Core.Exceptions.ParseException: 'No property or field 'fd9417ba' exists in type 'AuditLogDto''
If the guid starts with a number (Id == 1862fc11-e40e-41a9-84cd-03e11edd2f6f), it gives the error:
System.Linq.Dynamic.Core.Exceptions.ParseException: 'Operator '==' incompatible with operand types 'Guid' and 'UInt64''
In this case, the proper way to handle this using dynamic linq is to use this expression instead:
Id.Equals(Guid("fd9417ba-ce5c-43d1-b2a9-0048d9bec44b"))
Can you please generate proper filtering for guids or add an extension point to generate custom filtering expressions given a value and a type?
Or event better, that the datagrid was able to handle the IQueryable manipulations instead of passing that resposability to the user
Also, sorting by guid does not give error but seems to be broken too