title: EF 7 set initial default value for DateTime column
body: <p>I need to be able to set a DateTime column's initial value.</p>
  
  <p>When I specify "getutcdate() or DateTime.UtcNow </p>
  
  <pre><code>entity.Property(e =&gt; e.ShipDate).DefaultValue("getutcdate()")
  entity.Property(e =&gt; e.ShipDate).DefaultValue(DateTime.UtcNow)
  </code></pre>
  
  <p>and then run <code>dnx . ef migration add InitialMigration</code> EF generates a migration snapshot with:</p>
  
  <pre><code>b.Property&lt;DateTime?&gt;("ShipDate")
    .Required()
    .Annotation("Relational:ColumnDefaultValue", "getutcdate()")
    .Annotation("Relational:ColumnDefaultValueType", "System.String");
  </code></pre>
  
  <p>when I use DateTime.UtcNow...</p>
  
  <pre><code>b.Property&lt;DateTime?&gt;("ShipDate")
    .Annotation("Relational:ColumnDefaultValue", "635754129448768827")
    .Annotation("Relational:ColumnDefaultValueType", "System.DateTime");
  </code></pre>
  
  <p>and an initial migration:</p>
  
  <pre><code>ShipDate = table.Column(
    type: "datetime2", 
    nullable: false, 
    defaultValue: "getutcdate()"),
  </code></pre>
  
  <p>when I use DateTime.UtcNow...</p>
  
  <pre><code>ShipDate = table.Column(
    type: "datetime2", 
    nullable: true, 
    defaultValue: new DateTime(2015, 8, 17, 12, 55, 44, 876, DateTimeKind.Unspecified)),
  </code></pre>
  
  <p>It would seem like it has to work, but when I insert data into the table, the default value for the column is the 'instant' in which the timestamp was created.</p>
  
  <p>Am I missing something?</p>
  
  <p>ALSO, since in the same vein, how to specify the IDENTITY SEED in EF7?</p>
  
  <p>Thanks</p>
  
  <p><strong>UPDATE</strong>
  After generating the sql script , with both options I get:</p>
  
  <p>If using "getutcdate()":</p>
  
  <pre><code>[ShipDate] datetime2 DEFAULT 'getutcdate()',
  </code></pre>
  
  <p>which does not work because of the quotes</p>
  
  <p>or if using DateTime.utcNow:</p>
  
  <pre><code>[ShipDate] datetime2 DEFAULT '2015-08-17 12:55:44.8760000'
  </code></pre>
  
  <p>which explains the static value I was getting.</p>
  
  <p>I guess I can manage with this.
  Is this is a bug or is there a correct way of doing this?
  Thanks</p>