Следующая выдает ошибку:LINQ к Entities не распознает метод «System.TimeSpan Subtract (System.DateTime)
public FieldViewer GetFieldViewByFieldIDIPAndUserByDate(int fieldID, string ip, string userID, DateTime date)
{
return this.context.FieldViewers.Where(x =>
x.Field.FieldID == fieldID &&
x.Viewer.IPAddress == ip &&
x.Viewer.User.Id == userID &&
date.Subtract(x.Viewer.CreatedAt).TotalMinutes >= 10).FirstOrDefault();
}
LINQ to Entities does not recognize the method 'System.TimeSpan Subtract(System.DateTime)' method, and this method cannot be translated into a store expression.
Как идти о решении этого как мне нужно вычесть за запрос вместо этого.
https://msdn.microsoft.com/en-us/library/dd395530(v=vs.110).aspx возможно? пример использования http://stackoverflow.com/questions/17486218/how-to-subtract-entityfunctions-truncatetime-from-custom-time – Ric
Возможный дубликат [LINQ to Entities для вычитания 2 дат] (http://stackoverflow.com/questions/570858/linq-to-entities-for-subtracting-2-date) – Default