这是我的代码:
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; }
如果我调用contractStartDate.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的子代