本文整理匯總了C#中System.EnterpriseServices.Activity類的典型用法代碼示例。如果您正苦於以下問題:C# Activity類的具體用法?C# Activity怎麽用?C# Activity使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Activity類屬於System.EnterpriseServices命名空間,在下文中一共展示了Activity類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: OnCall
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();
}
}