1

I need to execute an EF LINQ query that adds some seconds to a datetime against MySQL using the standard Oracle supplied dot net connector. Unfortunately it does not support the EntityFunctions.AddSeconds method. Is there an alternative approach?

var result = (from rec in db.Records where EntityFunctions.AddSeconds(rec.SomeDate, rec.SomeSeconds) select rec).FirstOrDefault();
sipsorcery
  • 30,273
  • 24
  • 104
  • 155

1 Answers1

4
DELIMITER $$
drop function IF EXISTS AddSeconds$$
create function AddSeconds(theDate datetime, seconds int)
RETURNS datetime
DETERMINISTIC
begin
 return DATE_ADD(theDate, INTERVAL seconds SECOND);
end$$
sipsorcery
  • 30,273
  • 24
  • 104
  • 155