I added this to the issue tracker, hopefully Aaron has time to look at it in the near future.
Thanks for the suggestion!
Woggly:Hello!
We had some performance problems when we were editing a large amount of objects in a datagrid, which is bound to a LinqBindingList. By using a profiler we found out, that the method ItemShouldBeInList needs most of the time. We looked at it carefully and found out, that it would be enough for us to only check if the item fits the where-condition. We modified the method like shown below. What do you think? Will this cause any problems later on? We testet our app where the List is used and everything worked fine.
private bool ItemShouldBeInList(T item)
{
InnermostWhereFinder whereFinder = new InnermostWhereFinder();
MethodCallExpression whereExpression = whereFinder.GetInnermostWhere(_expression);
if (whereExpression == null) return false;
if (whereExpression.Arguments.Count if (whereExpression.Arguments[1] == null) return false;
Expression> whereBody = (Expression>)((UnaryExpression)(whereExpression.Arguments[1])).Operand;
List list = new List { item };
return list.AsQueryable().Count(whereBody) > 0;
//var searchable = _list as Linq.IIndexSearchable;
//if (searchable == null)
// return false;
//else
// return searchable.SearchByExpression(whereBody).Contains(item);
}
Thanks in advance!
Copyright (c) Marimer LLC