Share via


RelationalSyncProvider.CreateApplicationTransaction Method

When overridden in a derived class, enables an explicit transaction to be created in which to apply changes to an Oracle database.

This method is not CLS-compliant.  

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 ()
protected IDbTransaction CreateApplicationTransaction ()
protected function CreateApplicationTransaction () : IDbTransaction

Example

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
RelationalSyncProvider Members
Microsoft.Synchronization.Data Namespace