简体   繁体   中英

Connection Property in EF5

Am trying to establish SQL connection using Entityframework Connection and i got the beow code in google

((EntityConnection)dataContext.Connection).StoreConnection;

But am not able to get the Connection property.It is not available and thought some changes would have happened in EF5 similar to the below code and posting my clarification here.

dataContext.ContextOptions.LazyLoadingEnabled

In EF5

dataContext.Configuration.LazyLoadingEnabled

How do i get the connection Property in EF5 ? Or am i missing anything !

Thanks

The options on how we access has changed in EF5.

Here is the sample

var sConnection = ((dataContext)ctx.Database.Connection);

The above code will return as the SQL Connection property.

Hope this helps some one :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM