Get the Entity Framework Connection String

前端 未结 11 983
迷失自我
迷失自我 2021-01-31 02:27

We use Entity Framework 5, but have a requirement to ALSO use a normal database connection from the application for some custom SQL we need to perform.

So, I am creating

11条回答
  •  粉色の甜心
    2021-01-31 03:01

    //Entity Framework 5

    myContext.Database.Connection.ConnectionString
    

    //Entity Framework 6

    myContext.Database.Connection.ConnectionString
    

    //Entity Framework Core 1

    myContext.Database.GetDbConnection().ConnectionString
    

提交回复
热议问题