Activity クラス

定義

COM+ コンポーネントを作成せずに COM+ サービスを使うことができる、同期または非同期のバッチ作業を実行するためのアクティビティを作成します。 このクラスは継承できません。

public ref class Activity sealed
[System.Runtime.InteropServices.ComVisible(false)]
public sealed class Activity
[<System.Runtime.InteropServices.ComVisible(false)>]
type Activity = class
Public NotInheritable Class Activity
継承
Activity
属性

次のコード例では、 クラスを使用 Activity し、同期サービスを使用する方法を示します。

class SvcClass: IServiceCall
{
    static int callNumber = 0;
    public void OnCall()
    {
        callNumber++;
        System.Guid contextID = ContextUtil.ContextId;
        Console.WriteLine("This is call number "+ callNumber.ToString());
        Console.WriteLine(contextID.ToString());
        System.TimeSpan sleepTime = new System.TimeSpan(0,0,0,10);
        System.Threading.Thread.Sleep(sleepTime);
    }
}
class EnterpriseServicesActivityClass
{
    [STAThread]
static void Main(string[] args)
    {
        ServiceConfig serviceConfig = new ServiceConfig();
        serviceConfig.Synchronization = SynchronizationOption.Required;
        serviceConfig.ThreadPool = ThreadPoolOption.MTA;
        SvcClass serviceCall = new SvcClass();
    Activity activity = new Activity(serviceConfig);
        activity.AsynchronousCall(serviceCall);
        activity.AsynchronousCall(serviceCall);
        Console.WriteLine("Waiting for asynchronous calls to terminate");
        Console.Read();
    }
}

注釈

アクティビティに関連付けられているコンテキストは、 オブジェクトによって ServiceConfig 完全に決定されます。

コンストラクター

Activity(ServiceConfig)

Activity クラスの新しいインスタンスを初期化します。

メソッド

AsynchronousCall(IServiceCall)

指定したユーザー定義のバッチ作業を非同期に実行します。

BindToCurrentThread()

ユーザー定義の作業を現在のスレッドにバインドします。

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
SynchronousCall(IServiceCall)

指定したユーザー定義のバッチ作業を同期的に実行します。

ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)
UnbindFromThread()

SynchronousCall(IServiceCall) メソッドまたは AsynchronousCall(IServiceCall) メソッドによって送信したバッチ作業を実行しているスレッドとそのバッチ作業とのバインドを解除します。

適用対象