/// <summary> /// Return the base list view contents. /// </summary> /// <typeparam name="T">The type of the ListView.</typeparam> /// <param name="app">The application service.</param> /// <param name="ctx">The CoreDbContext service.</param> /// <param name="searchOptions">If applyng search, otherwise null.</param> /// <returns>Returns the IQueryable list.</returns> protected IQueryable <T> GetPopulatedView <T>(ApplicationService app, CoreDbContext ctx, SearchOptions searchOptions = null) where T : class { //Todo: Validate if still needed. GC.Collect(); SearchOptions = searchOptions; var list = GetItemsList <T>(app, ctx); if (searchOptions?.HasSearch() ?? false) { var searchProperty = Array.Find(SearchProperties, x => x.PropertyName == searchOptions.SearchProperty); if (searchProperty != null) { searchOptions.SearchType = searchProperty.Type; searchOptions.ComparisonType = searchProperty.Comparison; list = searchOptions.SearchList(list); } } if (!string.IsNullOrWhiteSpace(Sort)) { list = list.OrderBy(Sort); } return(list); }