title: Trying to change table names in ASP.NET Identity 2.0
body: <p>I want to change the names of the tables used by ASP.NET Identity 2.0. I've seen various similar questions but nothing that solves my problem. For instance this type of solution:
  <a href="http://www.goatly.net/customizing-table-names-for-identitydbcontextwithcustomuser-data-contexts">http://www.goatly.net/customizing-table-names-for-identitydbcontextwithcustomuser-data-contexts</a>
  seems to depend on Code First(?). At any rate implementing OnModelCreating does nothing for me. I've basically renamed the AspNetUsers and similar tables to my own names and want to be able to use these. I have an existing EF context (MyContext) that I want to use, so I modified it to derive from IdentityDbContext (editing the t4 template), and then in Startup.Auth I have:</p>
  
  <pre><code>        UserManagerFactory = () =&gt;
          {
              var context = new MyContext();
  
              Database.SetInitializer&lt;MyContext&gt;(new IdentityDbInitializer());
  
              var userStore = new UserStore&lt;IdentityUser&gt;(context){
                  DisposeContext = true
              };
  
              return new UserManager&lt;IdentityUser&gt;(userStore);
          };
  </code></pre>
  
  <p>But the problem occurs when I try to log in that I get "cannot contact server". I imagine that is because my UserStore has no way of knowing which are the User tables on my context. I'd hoped this is what the OnModelCreating code would do, but I'm hazy on this. I imagine UserStore is still looking for an "AspNetUsers" table, though I don't know where these names come from. I'm also uneasy about modifying the t4 template for my context - is this the way I'm supposed to derive from IdentityDbContext?</p>
  
  <p>Any help greatly appreciated.</p>