Some thing about Lambda Expression and NHB

LINQ体验(17)——LINQ to SQL语句之动态查询   example: ExpandedBlockStart.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();
            }

  

Lambda : http://www.cnblogs.com/killuakun/archive/2008/08/03/1259389.html http://www.cnblogs.com/terrylee/archive/2008/08/01/custom-linq-provider-part-1-expression-tree.html http://www.cnblogs.com/ninputer/archive/2009/08/28/expression_tree1.html http://www.cnblogs.com/126/archive/2007/08/15/857193.html http://www.cnblogs.com/lyj/archive/2008/03/25/1122157.html Lambda Expression Tree:  打造自己的LINQ Provider(上):Expression Tree揭秘 打造自己的LINQ Provider(中):IQueryable和IQueryProvider Linq To Sql进阶系列(六)用object的动态查询与保存log篇 Expression Tree上手指南 (一) ==> NHB

http://www.kontac.net/site/

http://www.cnblogs.com/lyj/archive/2008/11/10/1330542.html

转载于:https://www.cnblogs.com/atomplus/archive/2010/02/02/1662267.html


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部