title: How to generate and auto increment Id with EF Core Oracle
body: <p>I use entity framework core 2 Code first to generate data in Oracle 11g, the entity provider is dotConnect, my POCO class is as follow:</p>
  
  <pre><code>public partial class Favoritepage
  {
      [Key]
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public int Id { get; set; }
      public int Personnelid { get; set; }
      public int Pageid { get; set; }
  }
  </code></pre>
  
  <p>My DbContext is as follow:</p>
  
  <pre><code>public partial class ModelContext : DbContext
  {
      public virtual DbSet&lt;Favoritepage&gt; Favoritepage { get; set; }
  
      protected override void OnModelCreating(ModelBuilder modelBuilder)
      {
          base.OnModelCreating(modelBuilder);
          modelBuilder.HasSequence&lt;int&gt;("S_FAVORITEPAGE", "SECURITY")
              .StartsAt(1)
              .IncrementsBy(20);
  
          modelBuilder.Entity&lt;Favoritepage&gt;(entity =&gt;
          {
              entity.ToTable("FAVORITEPAGE", "SECURITY");
  
              entity.HasIndex(e =&gt; e.Id)
                  .HasName("PK_FAVORITEPAGE")
                  .IsUnique();
  
              entity.Property(e =&gt; e.Id).HasColumnName("ID").ForOracleHasDefaultValueSql("S_FAVORITEPAGE.NEXTVAL");
          });
      }
  }
  </code></pre>
  
  <p>When I insert entity like this:</p>
  
  <pre><code>static void Main(string[] args)
      {
          using (var dbContxt = new ModelContext())
          {
              var favo = new Favoritepage()
              {
                  Pageid = 11253,
                  Personnelid = 14313,
  
              };
              dbContxt.Favoritepage.Add(favo);
              dbContxt.SaveChanges();
              Console.ReadLine();
          }
      }
  </code></pre>
  
  <p>It does not work, and raise expcetion like this <code>ORA-01400 Cannot insert the value NULL into column 'Id'</code></p>
  
  <p>What's wrong?</p>