Get the Entity Framework Connection String

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

    Do you mean, can you use a SqlConnection with your EF DbContext?

    The DbContext class has a constructor where you can pass in a SqlConnection, and then tell EF whether or not it owns it.

    var YourContext = new YourContext(SqlConnection, true);
    

提交回复
热议问题