【发布时间】:2012-04-06 21:40:53
【问题描述】:
TimeSpan time24 = new TimeSpan(24, 0, 0);
TimeSpan time18 = new TimeSpan(18, 0, 0);
// first get today's sleeping hours
List<Model.Sleep> sleeps = context.Sleeps.Where(
o => (clientDateTime - o.ClientDateTimeStamp < time24) &&
o.ClientDateTimeStamp.TimeOfDay > time18 &&
clientDateTime.TimeOfDay < time18 &&
o.UserID == userid).ToList();
这个 Linq 表达式抛出这个异常:
DbArithmeticExpression arguments must have a numeric common type.
请帮忙!
【问题讨论】:
-
clientDateTime - o.ClientDateTimeStamp的结果是什么? -
通常应该是TimeSpan的对象,在EF中抛出异常。
标签: c# entity-framework ado.net