title: Override Identity ID type in .net core
body: <p>I'm trying to change the type of ID from the string default on an identity user.
  I get an exception when trying to register the Identity Service, in the configure services method.</p>
  
  <p>This is what I'm trying to do in my Startup.ConfigureServices method.</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
  
          services.AddDbContext&lt;UserContext&gt;(options =&gt;
                 options.UseSqlServer(config.GetConnectionString("DefaultConnection")));
  
          services.AddIdentity&lt;User, Role&gt;()
          .AddEntityFrameworkStores&lt;UserContext&gt;();
        //.AddDefaultTokenProviders();
  
          services.AddDbContext&lt;MusicContext&gt;(options =&gt;
                     options.UseSqlServer(config.GetConnectionString("DefaultConnection")));
  
          services.Configure&lt;IdentityOptions&gt;(options =&gt;
          {
            new IdentityOptionConfiguration(options);
          });    
       services.AddMvc();   
  }
  </code></pre>
  
  <p>Here is my class which inherits IdentityUser. This is where I'm trying to override the string type. I want it to be an int or maybe even a guid. I'm not sure which yet, but I'm going with an int for now.</p>
  
  <pre><code> public class User : IdentityUser&lt;int&gt;
   {
      public int ID { get; set; }
   }
  </code></pre>
  
  <p>And here is the role that I'm trying to use. I'm okay with the default roles that are given for the most part.</p>
  
  <pre><code> public class Role : IdentityRole
   {
   }
  </code></pre>
  
  <p>Now the exception I'm getting is as follows...</p>
  
  <blockquote>
    <p>System.Private.CoreLib.ni.dll but was not handled in user code</p>
    
    <p>Additional information: GenericArguments[0],
    'MusicianProject.Services.User', on
    'Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore`4[TUser,TRole,TContext,TKey]'
    violates the constraint of type 'TUser'.</p>
  </blockquote>
  
  <p>Based off of the wording of the error, I believe it's mad that I'm trying to change the type. What am I missing here?</p>