ContextUtil.EnableCommit 方法

定义

在 COM+ 上下文中将 consistent 位设置为 true,并将 done 位设置为 false

public:
 static void EnableCommit();
public static void EnableCommit ();
static member EnableCommit : unit -> unit
Public Shared Sub EnableCommit ()

例外

没有 COM+ 上下文可用。

示例

下面的代码示例调用 EnableCommit 方法。

[Transaction(TransactionOption::Required)]
public ref class ContextUtil_EnableCommit: public ServicedComponent
{
public:
   void Example()
   {
      // Set the consistent bit to true and the done bit to false for the
      // current COM+ context.
      ContextUtil::EnableCommit();
   }
};
[Transaction(TransactionOption.Required)]
public class ContextUtil_EnableCommit : ServicedComponent
{
    public void Example()
    {
        // Set the consistent bit to true and the done bit to false for the
        // current COM+ context.
        ContextUtil.EnableCommit();
    }
}
<Transaction(TransactionOption.Required)>  _
Public Class ContextUtil_EnableCommit
    Inherits ServicedComponent
    
    Public Sub Example() 
        ' Set the consistent bit to true and the done bit to false for the
        ' current COM+ context.
        ContextUtil.EnableCommit()
    
    End Sub
End Class

注解

如果系统询问,COM+ 上下文将提交当前事务,但对象不会在方法返回时停用。

适用于