Get server time not local one for EF entity
Posted: Tue 20 May 2014 10:54
I use dotConnect for SQLite 5.2.146 + Entity Framework 6.1.0 and Code-First approach.
Suppose I have a following Entity:
My database is located on server.
What I want to achieve is LastOperationDate to be server time, not my local machine time.
So what should I use instead of
Maybe some SQL?
Suppose I have a following Entity:
Code: Select all
public class User
{
[Key]
public int Id { get; set; }
public String Name{ get; set; }
public DateTime LastOperationDate{ get; set; }
}
What I want to achieve is LastOperationDate to be server time, not my local machine time.
So what should I use instead of
Code: Select all
LastOperationDate = DateTime.Now