RelationalSyncProvider.CreateApplicationTransaction 方法

在派生类中重写时,可以创建在其中将变更应用于 Oracle 数据库的显式事务。

此方法不符合 CLS。  

命名空间: Microsoft.Synchronization.Data
程序集: Microsoft.Synchronization.Data(在 microsoft.synchronization.data.dll 中)

语法

声明
Protected Overridable Function CreateApplicationTransaction As IDbTransaction
用法
Dim returnValue As IDbTransaction

returnValue = Me.CreateApplicationTransaction
protected virtual IDbTransaction CreateApplicationTransaction ()
protected:
virtual IDbTransaction^ CreateApplicationTransaction ()
protected IDbTransaction CreateApplicationTransaction ()
protected function CreateApplicationTransaction () : IDbTransaction

示例

下面的代码示例重写此方法并设置一个在 Oracle 数据库中启用快照行为的选项。

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

请参阅

参考

RelationalSyncProvider 类
RelationalSyncProvider 成员
Microsoft.Synchronization.Data 命名空间