本文整理汇总了C#中IService.GetService方法的典型用法代码示例。如果您正苦于以下问题:C# IService.GetService方法的具体用法?C# IService.GetService怎么用?C# IService.GetService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IService
的用法示例。
在下文中一共展示了IService.GetService方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Handle
/// <summary>
/// It handles the service request
/// </summary>
/// <param name="service">Service instance</param>
/// <exception cref="Siminov.Connect.Exception.ServiceException">If any exception occur while handling the service request</exception>
public void Handle(IService service)
{
ServiceDescriptor serviceDescriptor = service.GetServiceDescriptor();
if(serviceDescriptor == null)
{
serviceDescriptor = resourceManager.RequiredServiceDescriptorBasedOnName(service.GetService());
service.SetServiceDescriptor(serviceDescriptor);
}
IEnumerator<String> resources = service.GetResources();
while(resources.MoveNext())
{
String resourceName = resources.Current;
Object resourceValue = service.GetResource(resourceName);
if(resourceValue is String)
{
serviceDescriptor.AddProperty(resourceName, (String) resourceValue);
}
}
Connect.Model.ServiceDescriptor.Request request = serviceDescriptor.GetRequest(service.GetRequest());
var serviceDescriptors = new List<Core.Model.IDescriptor>();
serviceDescriptors.Add(serviceDescriptor);
String mode = ResourceUtils.Resolve(request.GetMode(), serviceDescriptors.ToArray());
if(mode.Equals(Constants.SERVICE_DESCRIPTOR_REQUEST_SYNC_REQUEST_MODE, StringComparison.OrdinalIgnoreCase))
{
ResourceUtils.Resolve(service);
syncServiceWorker.Process(service);
}
else if(mode.Equals(Constants.SERVICE_DESCRIPTOR_REQUEST_ASYNC_REQUEST_MODE, StringComparison.OrdinalIgnoreCase))
{
asyncServiceWorker.AddRequest(service);
}
}
示例2: Convert
/// <summary>
/// It converts IService instance to database service request instance
/// </summary>
/// <param name="iService">IService instance</param>
/// <returns>ServiceRequest Instance</returns>
public Connect.Model.ServiceRequest Convert(IService iService)
{
Connect.Model.ServiceRequest serviceRequest = new Connect.Model.ServiceRequest();
serviceRequest.SetRequestId(iService.GetRequestId());
serviceRequest.SetService(iService.GetService());
serviceRequest.SetRequest(iService.GetRequest());
serviceRequest.SetInstanceOf(iService.GetType().Name);
IEnumerator<String> resources = iService.GetResources();
while(resources.MoveNext())
{
String resourceName = resources.Current;
Object resourceValue = iService.GetResource(resourceName);
if(!(resourceValue is String))
{
continue;
}
ServiceRequestResource serviceRequestResource = new ServiceRequestResource();
serviceRequestResource.SetServiceRequest(serviceRequest);
serviceRequestResource.SetName(resourceName);
serviceRequestResource.SetValue((String) resourceValue);
serviceRequest.AddServiceRequestResource(serviceRequestResource);
}
return serviceRequest;
}