ObjectContext::Connection Property
.NET Framework (current version)
Gets the connection used by the object context.
Assembly: System.Data.Entity (in System.Data.Entity.dll)
| Exception | Condition |
|---|---|
| ObjectDisposedException | When the ObjectContext instance has been disposed. |
This property returns the connection object that was passed into the constructor or created during construction. The connection’s ownership is determined by the constructors used.
This example creates an EntityConnection object that is passed into the constructor of a long-running ObjectContext. The connection is opened manually. Both the EntityConnection object and the ObjectContext object are disposed of manually.
.NET Framework
Available since 3.5
Available since 3.5
Show: