I upgraded to Core 1.1 and Visual Studio 2017. I am running a simple existing line of code to find a column for a user-entered row, but I get an error ...
InvalidOperationException: variable '__searchTerm_1' of type 'System.String' is referenced from scope '' but not defined
In short, my code is:
public IQueryable<SearchViewModel> ActivitySearch(string searchTerm) { var qry = (from act in context.Acts .Include(x => x.ActivityExt) select new SearchViewModel() { AMCNnumber = act.AMCNnumber ActivityId = act.ActivityID, ImplementingPartner = act.ActivityExt.imp, ProjectTitle = act.Name, Description = act.Description, StartDate = act.StartDate, EndDate = act.EndDate }); if (!String.IsNullOrEmpty(searchTerm)) { qry = qry.Where(x => x.AMCNnumber.Contains(searchTerm); } return qry.ToArray(); }
source share