【发布时间】:2011-10-27 21:30:59
【问题描述】:
我正在使用实体框架 4.0。
客户是我的 ObjectContext 中的一个实体,而 Enity 类是自动生成的。我得到这样的客户:
Public Function GetAll(ByVal companyId As String) As System.Collections.Generic.IEnumerable(Of Customer) Implements ICustomerRepository.GetAll
Return Me.objectSet.Where(Function(p) p.CompId = >companyId).AsEnumerable
End Function
我的函数返回正确的结果集,但它并没有只选择 Comp.Id = conmpanyId 的客户。我也试过了
Return From p In Me.objectSet Where p.CompId = companyId Select p
如何正确编写查询?
【问题讨论】:
标签: entity-framework linq-to-entities