這是我的代碼:實體框架5.0。我的查詢有什麼問題?
public DateTime GibSomeStartDate(IEnumerable<int> partnerNumbers, DateTime startTime)
{
var contractsStartDate = from contract in this.databaseContext.Contract
where partnerNumbers.Contains(contract.Pnr)
&& contract.SomeDateTime >= startTime
select contract.SomeDateTime;
}
如果我叫contractsStartDate.Min()
發生異常:
Unable to create a null constant value of type 'System.Collections.Generic.IEnumerable`1'. Only entity types, enumeration types or primitive types are supported in this context.
什麼是錯我的查詢?
的
contractsStartDate
的類型是System.Data.Entity.Infrastructure.DbQuery
EF的5.0
databaseContext
是System.Data.Entity.DbContext
@GalacticCowboy - JustAnotherUserYouMayKnow有嚴格的答案)它是空:(謝謝!) – MikroDel 2013-03-12 14:18:18