码迷,mamicode.com
首页 > 其他好文 > 详细

LINQ To EF

时间:2018-04-19 14:00:49      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:sele   customers   写法   result   class   lambda   排序   条件查询   where   

1. 简单查询

                var result = from c in db.Customers select c;

2. 条件查询

   普通 LINQ 写法:

                var result = from c in db.Customers where c.Country == "UK" select c;

   Lambda 表达式写法:

                var result = db.Customers.Where(c => c.Country == "UK");

3. 排序分页

LINQ To EF

标签:sele   customers   写法   result   class   lambda   排序   条件查询   where   

原文地址:https://www.cnblogs.com/zhangchaoran/p/8881589.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!