example:
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
using
(EmployeeDBDataContext db
=
new
EmployeeDBDataContext())
{
var l = db.VW_EMPLOYEEs;
ParameterExpression param = Expression.Parameter( typeof (VW_EMPLOYEE), " p " );
Expression left = Expression.Property(param, typeof (VW_EMPLOYEE).GetProperty( " EMPLID " ));
Expression right = Expression.Constant(emp.EMPLID);
Expression filter = Expression.Equal(left, right);
Expression pred = Expression.Lambda(filter, param);
Expression expr = Expression.Call( typeof (Queryable), " Where " ,
new Type[] { typeof (VW_EMPLOYEE) },
Expression.Constant(l), pred);
IQueryable < VW_EMPLOYEE > query = db.VW_EMPLOYEEs.AsQueryable().Provider.CreateQuery < VW_EMPLOYEE > (expr);
return query.ToList();
}
{
var l = db.VW_EMPLOYEEs;
ParameterExpression param = Expression.Parameter( typeof (VW_EMPLOYEE), " p " );
Expression left = Expression.Property(param, typeof (VW_EMPLOYEE).GetProperty( " EMPLID " ));
Expression right = Expression.Constant(emp.EMPLID);
Expression filter = Expression.Equal(left, right);
Expression pred = Expression.Lambda(filter, param);
Expression expr = Expression.Call( typeof (Queryable), " Where " ,
new Type[] { typeof (VW_EMPLOYEE) },
Expression.Constant(l), pred);
IQueryable < VW_EMPLOYEE > query = db.VW_EMPLOYEEs.AsQueryable().Provider.CreateQuery < VW_EMPLOYEE > (expr);
return query.ToList();
}
Lambda :