EntityConnection.BeginTransaction Method

 

Begins a database transaction.

Namespace:   System.Data.Entity.Core.EntityClient
Assembly:  EntityFramework (in EntityFramework.dll)

NameDescription
System_CAPS_pubmethodBeginTransaction()

Begins a transaction by using the underlying provider.

System_CAPS_pubmethodBeginTransaction(IsolationLevel)

Begins a transaction with the specified isolation level by using the underlying provider.


EntityConnection.BeginTransaction Method ()

Begins a transaction by using the underlying provider.

public virtual EntityTransaction BeginTransaction()

Return Value

Type: System.Data.Entity.Core.EntityClient.EntityTransaction

A new EntityTransaction. The returned EntityTransaction instance can later be associated with the EntityCommand to execute the command under that transaction.

Exception Condition
InvalidOperationException

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 .


EntityConnection.BeginTransaction Method (IsolationLevel)

Begins a transaction with the specified isolation level by using the underlying provider.

public virtual EntityTransaction BeginTransaction(
	IsolationLevel isolationLevel
)

Parameters

isolationLevel
Type: System.Data.IsolationLevel

The isolation level of the transaction.

Return Value

Type: System.Data.Entity.Core.EntityClient.EntityTransaction

A new EntityTransaction. The returned EntityTransaction instance can later be associated with the EntityCommand to execute the command under that transaction.

Exception Condition
InvalidOperationException

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 .