Get the Entity Framework Connection String

前端 未结 11 1155
迷失自我
迷失自我 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:15

    You can get the connectionstring used by EF by using the following:

    MyDbContext.Database.Connection.ConnectionString
    

    Or as mark says you can initalise the context with a sqlconnection

提交回复
热议问题