EntityConnection.BeginTransaction Method   
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Begins a database transaction.
Overloads
| BeginTransaction() | Begins a transaction by using the underlying provider. | 
| BeginTransaction(IsolationLevel) | Begins a transaction with the specified isolation level by using the underlying provider. | 
BeginTransaction()
Begins a transaction by using the underlying provider.
public:
 System::Data::EntityClient::EntityTransaction ^ BeginTransaction();public System.Data.EntityClient.EntityTransaction BeginTransaction();override this.BeginTransaction : unit -> System.Data.EntityClient.EntityTransactionPublic Function BeginTransaction () As EntityTransactionReturns
A new EntityTransaction. The returned EntityTransaction instance can later be associated with the EntityCommand to execute the command under that transaction.
Exceptions
The underlying provider is not known.
-or-
The call to BeginTransaction() was made on an EntityConnection that already has a current transaction.
-or-
The state of the EntityConnection is not Open.
Remarks
The BeginTransaction method uses the Unspecified transaction isolation level. To specify a different isolation level, call BeginTransaction. This value might be interpreted differently by different underlying providers. If you want your application to be portable across multiple providers, it should explicitly specify the transaction isolation level by calling BeginTransaction.
At any particular moment there can be no more than one active transaction that was created through BeginTransaction. An attempt to call any of the BeginTransaction overloads on an EntityConnection that already has a current transaction results in an InvalidOperationException.
Applies to
BeginTransaction(IsolationLevel)
Begins a transaction with the specified isolation level by using the underlying provider.
public:
 System::Data::EntityClient::EntityTransaction ^ BeginTransaction(System::Data::IsolationLevel isolationLevel);public System.Data.EntityClient.EntityTransaction BeginTransaction(System.Data.IsolationLevel isolationLevel);override this.BeginTransaction : System.Data.IsolationLevel -> System.Data.EntityClient.EntityTransactionPublic Function BeginTransaction (isolationLevel As IsolationLevel) As EntityTransactionParameters
- isolationLevel
- IsolationLevel
The isolation level of the transaction.
Returns
A new EntityTransaction. The returned EntityTransaction instance can later be associated with the EntityCommand to execute the command under that transaction.
Exceptions
The underlying provider is not known.
-or-
The call to BeginTransaction() was made on an EntityConnection that already has a current transaction.
-or-
The state of the EntityConnection is not Open.
Remarks
At any particular moment there can be no more than one active transaction that was created through BeginTransaction. An attempt to call any of the BeginTransaction overloads on an EntityConnection that already has a current transaction results in an InvalidOperationException.