Changing the default Identity / Membership authentication database in ASP.NET MVC 5.1

I am currently starting a new project in Visual Studio 2013 with ASP.NET MVC5 using Entity Framework Model-First. The entity is all right, by now ... haha

My question is: Is there a way to change an Identity database without overwriting it?

The explanation is better: Currently, my database created from Entity is well located in my external SQL Server database, but my account information is in (I think it is) SQL Server, which works with Visual Studio 2013.

Strengthening it: I just want to change the database in the same way as my Entity Framework, I don't want to overwrite it. Is it possible?

+4
source share
1 answer

You must modify the ConnectionString to point to the correct database. Identity uses EF to create the database and schema. Alternatively, you can pass the ConnectionString of your EF database to IdentityDbContext. For example, in this example, DefaultConnection is the name ConnectionString used by my EF Context and Identity Context:

public class MyDbContext : IdentityDbContext<ApplicationUser>
    {
        public MyDbContext()
            : base("DefaultConnection")
        {
        }
    }
+8
source

Source: https://habr.com/ru/post/1544837/


All Articles