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.
请帮忙!
通常,它应该是TimeSpan的对象,但会抛出EF异常。
—
Nawaz Dhandala 2012年
clientDateTime - o.ClientDateTimeStamp
什么?