Share via


RelationalSyncProvider.CreateApplicationTransaction Method

Creates a read-committed transaction over which to apply changes to the database.

Namespace:  Microsoft.Synchronization.Data
Assembly:  Microsoft.Synchronization.Data (in Microsoft.Synchronization.Data.dll)

Syntax

'Declaration
Protected Overridable Function CreateApplicationTransaction As IDbTransaction
'Usage
Dim returnValue As IDbTransaction

returnValue = Me.CreateApplicationTransaction()
protected virtual IDbTransaction CreateApplicationTransaction()
protected:
virtual IDbTransaction^ CreateApplicationTransaction()
abstract CreateApplicationTransaction : unit -> IDbTransaction 
override CreateApplicationTransaction : unit -> IDbTransaction 
protected function CreateApplicationTransaction() : IDbTransaction

Return Value

Type: System.Data.IDbTransaction
The transaction used to apply changes to the database.

Examples

The following code example overrides this method and sets an option that enables snapshot behavior in the Oracle database.

protected override IDbTransaction CreateApplicationTransaction()
        {
            OracleTransaction trans = (OracleTransaction)this.Connection.BeginTransaction();
            new OracleCommand("set transaction read only", (OracleConnection)this.Connection, trans).ExecuteNonQuery();
            return trans;        
        }
Protected Overloads Overrides Function CreateApplicationTransaction() As IDbTransaction
    Dim trans As OracleTransaction = DirectCast(Me.Connection.BeginTransaction(), OracleTransaction)
    New OracleCommand("set transaction read only", DirectCast(Me.Connection, OracleConnection), trans).ExecuteNonQuery() 
    Return trans
End Function

See Also

Reference

RelationalSyncProvider Class

Microsoft.Synchronization.Data Namespace