本文整理汇总了C#中IService.OnRequestInvoke方法的典型用法代码示例。如果您正苦于以下问题:C# IService.OnRequestInvoke方法的具体用法?C# IService.OnRequestInvoke怎么用?C# IService.OnRequestInvoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IService
的用法示例。
在下文中一共展示了IService.OnRequestInvoke方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Handle
/// <summary>
/// It handles the service request
/// </summary>
/// <param name="service">Service instance</param>
/// <returns>IConnectionResponse instance</returns>
/// <exception cref="Siminov.Connect.Exception.ConnectionException">If any exception occur while executing service request</exception>
public IConnectionResponse Handle(IService service)
{
IConnectionRequest connectionRequest = ConnectionHelper.PrepareConnectionRequest(service);
/*
* Service Event onServiceApiInvoke
*/
service.OnRequestInvoke(connectionRequest);
IConnection connection = null;
if(connectionRequest.GetProtocol().Equals(Constants.SERVICE_DESCRIPTOR_HTTP_PROTOCOL, StringComparison.OrdinalIgnoreCase))
{
connection = httpConnection;
}
else if(connectionRequest.GetProtocol().Equals(Constants.SERVICE_DESCRIPTOR_HTTPS_PROTOCOL, StringComparison.OrdinalIgnoreCase))
{
connection = httpsConnection;
}
IConnectionResponse connectionResponse = null;
if(connectionRequest.GetType().Equals(Constants.SERVICE_DESCRIPTOR_REQUEST_GET_TYPE, StringComparison.OrdinalIgnoreCase))
{
connectionResponse = connection.Get(connectionRequest);
}
else if (connectionRequest.GetType().Equals(Constants.SERVICE_DESCRIPTOR_REQUEST_HEAD_TYPE, StringComparison.OrdinalIgnoreCase))
{
connectionResponse = connection.Head(connectionRequest);
}
else if (connectionRequest.GetType().Equals(Constants.SERVICE_DESCRIPTOR_REQUEST_POST_TYPE, StringComparison.OrdinalIgnoreCase))
{
connectionResponse = connection.Post(connectionRequest);
}
else if (connectionRequest.GetType().Equals(Constants.SERVICE_DESCRIPTOR_REQUEST_PUT_TYPE, StringComparison.OrdinalIgnoreCase))
{
connectionResponse = connection.Put(connectionRequest);
}
else if (connectionRequest.GetType().Equals(Constants.SERVICE_DESCRIPTOR_REQUEST_DELETE_TYPE, StringComparison.OrdinalIgnoreCase))
{
connectionResponse = connection.Delete(connectionRequest);
}
else if (connectionRequest.GetType().Equals(Constants.SERVICE_DESCRIPTOR_REQUEST_TRACE_TYPE, StringComparison.OrdinalIgnoreCase))
{
connectionResponse = connection.Trace(connectionRequest);
}
else if (connectionRequest.GetType().Equals(Constants.SERVICE_DESCRIPTOR_REQUEST_OPTIONS_TYPE, StringComparison.OrdinalIgnoreCase))
{
connectionResponse = connection.Options(connectionRequest);
}
else if (connectionRequest.GetType().Equals(Constants.SERVICE_DESCRIPTOR_REQUEST_CONNECT_TYPE, StringComparison.OrdinalIgnoreCase))
{
connectionResponse = connection.Connect(connectionRequest);
}
else if (connectionRequest.GetType().Equals(Constants.SERVICE_DESCRIPTOR_REQUEST_PATCH_TYPE, StringComparison.OrdinalIgnoreCase))
{
connectionResponse = connection.Patch(connectionRequest);
}
return connectionResponse;
}