C # - EF4 - Get a DateTime.Now server

I have a fat client application that uses EF4 for MSSQL in a data layer. Before using EF4 (in regular ADO.Net), I had a wrapper function that receives the DateTime.Now SQL server (a simple SELECT GETDATE()wrapped C # client call).

Now I find that using SQL functions and SPs that return simple value types in EF4 is not so simple. What is the easiest and most efficient way to get a datetime server now in this scenario?

I would like to avoid creating a wrapper object for this, if possible.

+3
source share
1 answer
DateTime ServerDate = Entities.CreateQuery<DateTime>("CurrentDateTime()").AsEnumerable().First();
+8
source

All Articles