Linq To EF
l简单查询:
var result = from c in Entities.Customer select c;
var result = from c in Entities.Customer select c;
l条件查询:
普通linq写法: var result = from c in Entities.Customer where c.Gender ==‘w’ select c;
Lambda表达式写法: var result = from c in Entities.Customer.Where<Customer>(c =>c.Gender==‘w’);
排序分页写法: IQueryable<Customers> cust10 = (from c in customers
l orderby c.CustomerID
l select c).Skip(0).Take(10);
l左外连接:可以的连接有Join 和 GroupJoin 方法。GroupJoin组联接等效于左外部联接,它返回第一个(左侧)数据源的每个元素(即使其他数据源中没有关联元素)。
l var query = from d in edm.Order_Details
l join order in edm.Orders
l on d.OrderID equals order.OrderID
l select new
l {
l OrderId = order.OrderID,
l ProductId = d.ProductID,
l UnitPrice = d.UnitPrice
重来没有接触过,零基础学习软件编程,一个字累