15
ricevo questo errore suLINQ alle entità non riconosce il metodo 'System.DateTime AddSeconds (doppia)' metodo, e questo metodo non può essere tradotto in
base {System.SystemException} = {"LINQ to Entities does not recognize the method 'System.DateTime AddSeconds(Double)' method, and this method cannot be translated into a store expression."}
su questo codice
var eventToPushCustom = eventCustomRepository.FindAllEventsCustomByUniqueStudentReference(userDevice.UniqueStudentReference)
.Where(x => x.DateTimeStart > currentDateTime && currentDateTime >= x.DateTimeStart.AddSeconds(x.ReminderTime))
.Select(y => new EventPushNotification
{
Id = y.EventId,
EventTitle = y.EventTitle,
DateTimeStart = y.DateTimeStart,
DateTimeEnd = y.DateTimeEnd,
Location = y.Location,
Description = y.Description,
DeviceToken = y.UsersDevice.DeviceTokenNotification
});
Credo che il problema sia in x.DateTimeStart.AddSeconds(x.ReminderTime)
L'argomento di .AddSeconds nel mio caso deve essere "dinamico" ... Qualche idea su come risolverlo?
Si noti che EntityFunctions è ora obsoleto. Usa invece 'DbFunctions'. –
@TylerForsythe grazie per l'aggiornamento! È un mondo in rapida evoluzione :) –
{"FUNCTION db.AddMinutes non esiste"} :( –