title: How can I specify defaultValueSql for all primary keys in entity framework core and npgsql
body: <p>I have my own sequence generating function in PostgreSql, <code>next_id()</code> below, that I would like to use as default value for all primary keys with Entity Framework Core. Is there any way to achieve this? </p>
  
  <p>I am trying to avoid the following situation where I have to specify it for all entities. </p>
  
  <pre><code>protected override void OnModelCreating(ModelBuilder builder)
      {
          base.OnModelCreating(builder);
  
          // Don't want to repeat this command for every entity!
          builder.Entity&lt;Vote&gt;()
          .Property(v =&gt; v.VoteId)
              .HasDefaultValueSql("next_id()");
  
          ....
      }
  </code></pre>