example:
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 :
Lambda Expression Tree: