How to change database name in dbcontext connection string at runtime

后端 未结 3 2216
孤独总比滥情好
孤独总比滥情好 2020-12-06 23:34

My Asp.Net MVC application is setup as follows. There are 4 projects in solution.

  • ge.Web
  • ge.BLL
  • ge.Core
  • ge.Entities

<

3条回答
  •  心在旅途
    2020-12-07 00:07

    You can change the database for an open connection

    context.Database.GetDbConnection().ChangeDatabase("");
    

提交回复
热议问题