I will do it a little differently.
First install the nuget System.Linq.Dynamic package
Install-Package System.Linq.Dynamic
After that, `IQueryable Where function will support the string as a parameter. So you can do this:
protected static IQueryable<T> ApplyGridFilter<T>(IQueryable<T> query)
{
var qText = "id == 1";
query = query.Where(qText);
return query;
}
, Func<Class1, bool>>