My query below checks through over 2000 categories categoriesToCheck
and find articles within those categories. I guess it is too big to add to a generic list?
I'm getting an error from this line below listInitialResult.AddRange(queryableInitialResult.ToList());
namely:
An unhandled exception of type 'System.StackOverflowException' occurred
I hope anyone can suggest a good way of doing this.
if (categoriesToCheck != null && categoriesToCheck.Count() > 0)
{
var searchPredicate = PredicateBuilder.False<T>();
foreach (ID category in categoriesToCheck)
{
var categoryToCompare = category.ToString().Replace("{", "").Replace("}", "");
searchPredicate = searchPredicate.Or(i => i.Tags.Contains(categoryToCompare));
}
queryableInitialResult = queryable.Where(searchPredicate);
listInitialResult.AddRange(queryableInitialResult.ToList());
}