I am trying to use entity framework and get the date from the SQL server. The old way of doing this in LINQ is below but i\'m needing something for the entity framework:
The EF Canonical function to return a UTC date time is: CurrentUtcDateTime()
See also: http://msdn.microsoft.com/en-us/library/bb738563.aspx
Search at google "efquerysamples" entity framework samples and download those good examples then look canonical function CurrentDateTime(), it worked with:
DateTime fecha = ServicioContexto.Contexto.CreateQuery("CurrentDateTime()").Execute(MergeOption.NoTracking).First();
I'd like to understand more about canonical functions. Please explain me. Thank you
Have you tried using DateTime.Now
or DateTime.UtcNow
? I'd like to think that would be converted into GetSystemDate()
by the query translator.