Entity Framework Core in ASP.NET 5 web project - Autogenerate LINQ filters query Entity Framework Core in ASP.NET 5 web project - Autogenerate LINQ filters query asp.net asp.net

Entity Framework Core in ASP.NET 5 web project - Autogenerate LINQ filters query


In fact, I have done such a thing

I Recommend You to Learn about Expression Trees in Linq.Expression as The Link Below I Implement this Before You can Find Your Questions Answers in this link

but for More Understading How can Implement This I Put Some Example Codes Below:

     // Comment   _Queryable.Where(x=>x.Something) | This Queryable from      // Type Of Generics (Where Any model With Any Field With This)     var query = Expression.Equal(Expression.Property(keyParameter, filter.Key),                        Expression.Constant(filter.Value));                    MethodCallExpression whereExpression = Expression.Call(                        typeof(Queryable),                        "Where",                        new Type[] {_queryable.ElementType},                        _queryable.Expression,                        Expression.Lambda<Func<T, bool>>(query, new                       ParameterExpression[] {keyParameter}));                    _queryable =           _queryable.Provider.CreateQuery<T(whereExpression);

Sorry For My Bad English I Wish Its Help You