【发布时间】:2015-05-26 07:40:58
【问题描述】:
我的数据库中有一个Person 表,其中包含NationalId 字段。
有没有办法使用Ef code first 和Linq to entities 加载所有带有NationalId 的人员,而不将所有Persons 加载到内存中?
类似的东西:
public bool IsEven(int number)
{
return number % 2 == 0;
}
var context = new MyContext();
var personsWithEvenNationalId = context.Persons
.Where(x=> IsEven(x.NationalId))
.ToList();
【问题讨论】:
标签: c# entity-framework ef-code-first linq-to-entities