本文整理汇总了C#中IService.OnTerminate方法的典型用法代码示例。如果您正苦于以下问题:C# IService.OnTerminate方法的具体用法?C# IService.OnTerminate怎么用?C# IService.OnTerminate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IService
的用法示例。
在下文中一共展示了IService.OnTerminate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
/// <summary>
/// It process the service request
/// </summary>
/// <param name="service">Service instance</param>
public void Process(IService service)
{
IConnectionResponse connectionResponse = null;
try
{
connectionResponse = ConnectionManager.GetInstance().Handle(service);
}
catch(ConnectionException ce)
{
Log.Error(typeof(SyncServiceWorker).Name, "Process", "ConnectionException caught while invoking connection, " + ce.GetMessage());
service.OnTerminate(new ServiceException(ce.GetClassName(), ce.GetMethodName(), ce.GetMessage()));
return;
}
service.OnRequestFinish(connectionResponse);
}
示例2: Handle
private void Handle(IService iService)
{
IConnectionResponse connectionResponse = null;
try
{
connectionResponse = ConnectionManager.GetInstance().Handle(iService);
}
catch(ConnectionException se)
{
Log.Error(typeof(AsyncServiceWorker).Name, "Handle", "SiminovException caught while invoking connection, " + se.GetMessage());
iService.OnTerminate(new ServiceException(se.GetClassName(), se.GetMethodName(), se.GetMessage()));
return;
}
iService.OnRequestFinish(connectionResponse);
IDatabase serviceRequest = serviceUtils.Convert(iService);
try
{
serviceRequest.Delete().Execute();
}
catch(DatabaseException de)
{
Log.Error(typeof(AsyncServiceWorker).Name, "Handle", "Database Exception caught while deleting service request from database, " + de.GetMessage());
throw new SiminovCriticalException(typeof(AsyncServiceWorker).Name, "Handle", "Database Exception caught while deleting service request from database, " + de.GetMessage());
}
}