Entity Framework getting an sql connection

后端 未结 8 2016
栀梦
栀梦 2021-02-08 02:16

In the light of Closing connections explicitly in Entity Framework and http://msdn.microsoft.com/en-us/library/bb738582%28v=vs.90%29.aspx it seems that I should be using the con

8条回答
  •  旧巷少年郎
    2021-02-08 02:24

    In EF5 (changed for EF6) the following would return the connection:

    var connection = ((EntityConnection)context.Connection).StoreConnection;

    If you are using EF in a right way you will probably never need to get inner db connection.

提交回复
热议问题