DbContext wraps ObjectContext and exposes the most commonly used features of ObjectContext by using simplified and more intuitive APIs. You can access the underlyingObjectContext whenever you need to use features that are not supported by DbContext. For more information, see What’s Not Supported.
[This page is specific to the Entity Framework 4.1 release documentation. The Entity Framework 4.1 is built on top of the Entity Framework 4 included in .NET Framework 4. The Entity Framework 4.1 can be downloaded and installed from the Microsoft Download Center. The Entity Framework 4.1 runtime is also available as a 'Entity Framework' NuGet package.]
Constructs a new context instance around an existing ObjectContext.
Namespace: System.Data.Entity
Assembly: EntityFramework (in EntityFramework.dll)
public DbContext( ObjectContext objectContext, bool dbContextOwnsObjectContext )
Parameters
- objectContext
- Type: System.Data.Objects.ObjectContext
An existing ObjectContext to wrap the new context.
- dbContextOwnsObjectContext
- Type: System.Boolean
If set to true the ObjectContext is disposed when the DbContext is disposed, otherwise the caller must dispose the connection.