title: EF 2.1 Core IEntityTypeConfiguration Add default value
body: <p>I am using EF Core 2.1 to create a database.  I am able to set the default value of a column like </p>
  
  <pre><code>public class SchoolContext : DbContext
  {
      ....
      protected override void OnModelCreating(ModelBuilder modelBuilder) {
          ....
           modelBuilder.Entity&lt;Student&gt;().Property(s =&gt; s.LastLoginDateTime).HasDefaultValueSql("SYSUTCDATETIME()");
      }
      ....
  }
  </code></pre>
  
  <p>However, when I try to use the <code>IEntityTypeConfiguration</code> to set the default value, I get the build an error message (printed in the code below). I understand that the <code>HasDefaultValueSql()</code> is not available in <code>IEntityTypeConfiguration&lt;&gt;</code>. </p>
  
  <p>How can I work around with that limitation?  By the way, I followed the Scott Sauber in his 'Customizing EF Core 2.0+ Entity/Table Mapping with IEntityTypeConfiguration - Sept 11, 2017) to create my <code>SchoolContext</code>.  </p>
  
  <p><a href="https://scottsauber.com/2017/09/11/customizing-ef-core-2-0-with-ientitytypeconfiguration/" rel="nofollow noreferrer">https://scottsauber.com/2017/09/11/customizing-ef-core-2-0-with-ientitytypeconfiguration/</a></p>
  
  <p>My code:</p>
  
  <pre><code>public class StudentConfig : IEntityTypeConfiguration&lt;Student&gt;
  {
      public void Configure (EntityTypeBuilder&lt;Student&gt; builder)
      {
          ....
          // Error    CS1061  'PropertyBuilder&lt;DateTime&gt;' does
          // not contain a definition for 'HasDefaultValueSql' 
          // and no extension method 'HasDefaultValueSql' 
          // accepting a first argument of Type 'PropertyBuilder&lt;DateTime&gt;' 
          // could be found (are you missing a using directive
          // or an assembly reference?) 
          // Data C:\Users\Paul\source\repos\School\Data\EFClasses
          // \Configurations\StudentConfig.cs 22  Active
  
          builder.Entity&lt;Student&gt;().Property(s =&gt; s.RecIn).HasDefaultValueSql("SYSUTCDATETIME()");
          ....
      }
  }
  </code></pre>