0

I have created a new project with asp.net MVC5. I am trying to use the MVC5 methods to register and login. I have also changed the default connection of the database to my custom database connection.

The problem starts here:

When the user try to register the mvc5 generates his custom tables like:

  • AspNetRoles
  • AspNetUserClaims
  • AspNetUserLogins
  • AspNetUserRoles
  • AspNetUsers

i want to make him use my custom tables forexample instead of use aspnetusers i want to used dbo.Profile.

when i've done some research on the internet i have found this article: How can I change the table names when using Visual Studio 2013 ASP.NET Identity?

i have done the same thing that there is in that article. The problem is that the mvc5 is using my custom table but it is still generating those tables mentioned above. is there a way to make him stop generating those tables

any help please to make him generating those tables please????

Community
  • 1
  • 1
Whiplash
  • 93
  • 1
  • 10
  • Did you check the last part of the question that you followed? According to the -- UPDATE ANSWER -- part of the question, this issue (creating of standard tables) was solved. – ntl Sep 16 '14 at 05:39
  • If you’re still struggling with this issue, please post your original code so that we might help you further. – Indregaard Sep 16 '14 at 06:55
  • thanks for your comments i am going to try the answer below if this won't work i will post my code – Whiplash Sep 16 '14 at 20:21

1 Answers1

0

You have to add the line:

System.Data.Entity.Database.SetInitializer<ApplicationDbContext>(null);

like here:

protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
{
    base.OnModelCreating(modelBuilder);

    modelBuilder.Entity<ApplicationUserRole>().ToTable("UserRoles");
    modelBuilder.Entity<ApplicationUserLogin>().ToTable("UserLogins");
    modelBuilder.Entity<ApplicationUserClaim>().ToTable("UserClaims");
    modelBuilder.Entity<ApplicationRole>().ToTable("Roles");

    System.Data.Entity.Database.SetInitializer<ApplicationDbContext>(null);
}
Xavier Egea
  • 4,712
  • 3
  • 25
  • 39