title: EF Core giving me error Cannot insert explicit value for identity column in table 'Tags' when IDENTITY_INSERT is set to OFF
body: <p>My project using DDD pattern,is built by .NET-core and EF core. Today, I meet a question is that when I add a tag entity to my database, then do saveChanges. But the program throw a Exception: "Cannot insert explicit value for identity column in table 'Tags' when IDENTITY_INSERT is set to OFF"
  And I am puzzled, also, I search the question on the stackoverfolw and google. I found some solution is that use the attribute 
  <code>[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]</code>, but is doesn't work for me. Here is my code below:</p>
  
  <pre><code>C#//Entity
  public class Tags
  {
      [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
      public int TagId { get; set; }
      public string TagName { get; set; }
      public TagUseCount TagUseCount { get; set; }
      public enum Operation
      {
          None = 0,
          Add = 2, 
          Update = 4
      }
  }
  </code></pre>
  
  <p>The Function use in my Service Lawyer:</p>
  
  <pre><code>var tagEntity = new Tags { TagName = tag };
  var tagId = await _tagRepository.Add(tagEntity);
  </code></pre>
  
  <p>The Add Function is Repository Lawyer:</p>
  
  <pre><code>public async Task&lt;int&gt; Add(Tags tags)
      {
          try
          {
              _unitOfWork.Add(tags);
              await _unitOfWork.CommitAsync();
              return tags.TagId;
          }
          catch (Exception ex)
          {
              _logger.LogError(new EventId(), ex, "Error when add Tag!");
          }
          return 0;
      }
  </code></pre>
  
  <p>UOW Add Method:</p>
  
  <pre><code>TEntity IUnitOfWork.Add&lt;TEntity&gt;(TEntity entity)
      {
          return base.Set&lt;TEntity&gt;().Add(entity).Entity;     
      }
  </code></pre>
  
  <p><code>Version of EF core :"Microsoft.EntityFrameworkCore": "1.1.0"</code></p>
  
  <p>ModelBuilder below:</p>
  
  <pre><code>modelBuilder.Entity&lt;Tags&gt;().ToTable("Tags")
              .HasKey(x =&gt; x.TagId);
  
  
  modelBuilder.Entity&lt;TagUseCount&gt;().ToTable("TagUseCount")
              .HasKey(x =&gt; x.TagId);
  modelBuilder.Entity&lt;TagUseCount&gt;().ToTable("TagUseCount")
             .HasOne(x =&gt; x.tags)
             .WithOne(q =&gt; q.tagUseCount);
  </code></pre>
  
  <p>I am crazy with it for a couple of days, Who can help me ?</p>