title: SqlException: Cannot insert explicit value for identity column in table 'AspNetUsers' when IDENTITY_INSERT is set to OFF
body: <p>I have changed aspnetuser table column datatype string to long using enable-migration of Microsoft.AspNet.Identity.</p>
  
  <p>Table successfully created using following script of migration :</p>
  
  <pre><code>CreateTable(
  "dbo.AspNetUsers",
  c =&gt; new
  {
  Id = c.Long(nullable:false,identity:true),
  Email = c.String(maxLength: 256),
  EmailConfirmed = c.Boolean(nullable: false),
  PasswordHash = c.String(),
  SecurityStamp = c.String(),
  PhoneNumber = c.String(),
  PhoneNumberConfirmed = c.Boolean(nullable: false),
  TwoFactorEnabled = c.Boolean(nullable: false),
  LockoutEndDateUtc = c.DateTime(),
  LockoutEnabled = c.Boolean(nullable: false),
  AccessFailedCount = c.Int(nullable: false),
  UserName = c.String(nullable: false, maxLength: 256),
  FullName = c.String(nullable: false, maxLength: 50),
  CreatedBy = c.Long(nullable: true),
  CreatedDate = c.DateTime(),
  ModifiedDate = c.DateTime(nullable: false, defaultValue: null, defaultValueSql: null),
  ModifiedBy = c.Long(nullable: true),
  IsDeleted = c.Boolean(nullable: false, defaultValue: false, defaultValueSql: "0")
  })
  .PrimaryKey(t =&gt; t.Id)
  .Index(t =&gt; t.UserName, unique: true, name: "UserNameIndex");
  </code></pre>
  
  <p>But when i try to create user using following code getting error as "SqlException: Cannot insert explicit value for identity column in table 'AspNetUsers' when IDENTITY_INSERT is set to OFF".</p>
  
  <pre><code>// first we create Admin rool
  var role = new Microsoft.AspNet.Identity.EntityFramework.IdentityRole();
  role.Name = SuperAdminRole;
  roleManager.Create(role);
  
  //Here we create a Admin super user who will maintain the website               
  
  var user = new ApplicationUser();
  user.UserName = "Admin";
  user.Email = "xyz@gmail.com";
  user.FullName = "xyz";
  user.IsDeleted = false;
  user.ModifiedBy = null;
  user.ModifiedDate = null;
  user.CreatedBy = string.Empty;
  user.CreatedDate = DateTime.Now;
  
  string userPWD = "admin_123";
  var chkUser = UserManager.Create(user, userPWD);
  </code></pre>
  
  <p>If anybody have solution for this please share.</p>
  
  <p>Thanks for quick response!</p>