How do I setup ASP.NET Identity to use my own connection string?

后端 未结 2 1952
礼貌的吻别
礼貌的吻别 2020-12-14 17:06

I have an MVC5 app that\'s using EF. I would like to add ASP.NET Identity and I\'ve noticed that the connection string for ASP.NET identity is using \"DefaultConnection\". W

2条回答
  •  旧时难觅i
    2020-12-14 17:39

    The actual question shall be "How do I setup ASP.NET Identity to use my own connection string?"

    If above is the correct summary of your question, below is the answer.

    ASP.NET Identity uses EntityFramework for database related tasks. So you can use following option as suitable.

    Option 1: EntityFramework's default connection string can be setup using following code snippet in web.config

    
      
        
          
        
      
    
    

    Option 2: Programatically, you can also pass ConnectionString name to the DbContext's constructor. like new ApplicationDbContext(MyConnectionString)

提交回复
热议问题