The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
DbCompiledModel::CreateObjectContext<TContext> Method (DbConnection^)
Entity Framework 6.0
Creates an instance of ObjectContext or class derived from ObjectContext. Note that an instance of DbContext can be created instead by using the appropriate DbContext constructor. If a derived ObjectContext is used, then it must have a public constructor with a single EntityConnection parameter. The connection passed is used by the ObjectContext created, but is not owned by the context. The caller must dispose of the connection once the context has been disposed.
Assembly: EntityFramework (in EntityFramework.dll)
public: generic<typename TContext> where TContext : ObjectContext [SuppressMessageAttribute("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] TContext CreateObjectContext( DbConnection^ existingConnection )
Parameters
- existingConnection
-
Type:
System.Data.Common::DbConnection^
An existing connection to a database for use by the context.
Type Parameters
- TContext
The type of context to create.
Show: