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();
            }

  

Lambda :
 
 
 
   
 
posted on 2010-02-02 22:25  Atom Yan  阅读(216)  评论(0)    收藏  举报