I'm working on a backend API that's hosted on Azure and my dates are coming back in a different timezone. The way that I'm getting my dates currently is by using a custom Up()
method in my Migrations folder, that looks similar to this:
public partial class MyMigration : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.Users",
c => new
{
Created = c.DateTime(nullable: false, defaultValueSql: "GETDATE()"),
})
.PrimaryKey(t => t.ID);
... //
I've been reading about sysdatetimeoffset()
and datetimeoffset()
but I wouldn't know how to put them to use in this context.
Question
Is there a way to set a database generated default DateTime with an offset using Entity Framework code-first migration?