当前位置: 首页>>代码示例>>C#>>正文


C# IService.OnTerminate方法代码示例

本文整理汇总了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);
	    }
开发者ID:gitter-badger,项目名称:connect-1,代码行数:23,代码来源:SyncServiceWorker.cs

示例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());
			}
		}
开发者ID:gitter-badger,项目名称:connect-1,代码行数:31,代码来源:AsyncServiceWorker.cs


注:本文中的IService.OnTerminate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。