标签:
1.LINQ过滤数据
var query = from person in context.People where person.FirstName.StartsWith("a") select person; var methodQuery = context.People.Where(p => p.FirstName.StartsWith("a"));
两种不同的写法,效果一样。
var query = from person in context.People where person.FirstName.StartsWith("a") && person.LastName.EndsWith("b") select person; var methodQuery = context.People.Where(p => p.FirstName.StartsWith("a") && p.LastName.EndsWith("b"));
var query = from person in context.People where person.FirstName.StartsWith("a") && person.LastName.EndsWith("b") orderby person.FirstName,person.LastName select person; var methodQuery = context.People .Where(p => p.FirstName.StartsWith("a") && p.LastName.EndsWith("b")) .OrderBy(p => p.FirstName) .ThenBy(p => p.LastName);
Entity Framework学习三:查询、插入、更新和删除操作
标签:
原文地址:http://www.cnblogs.com/zjmsky/p/4823847.html