本文整理汇总了C#中Connect.GetInstanceOf方法的典型用法代码示例。如果您正苦于以下问题:C# Connect.GetInstanceOf方法的具体用法?C# Connect.GetInstanceOf怎么用?C# Connect.GetInstanceOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connect
的用法示例。
在下文中一共展示了Connect.GetInstanceOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Convert
/// <summary>
/// Converts the service request database instance to IService instance
/// </summary>
/// <param name="service">ServiceRequest instance</param>
/// <returns>IService instance</returns>
/// <exception cref="Siminov.Connect.Exception.ServiceException">ServiceException If any exception occur while converting the instance</exception>
public IService Convert(Connect.Model.ServiceRequest service)
{
IService iService = (IService) ClassUtils.CreateClassInstance(service.GetInstanceOf());
iService.SetRequestId(service.GetRequestId());
iService.SetService(service.GetService());
iService.SetRequest(service.GetRequest());
IEnumerator<ServiceRequestResource> serviceRequestResources = service.GetServiceRequestResources();
while(serviceRequestResources.MoveNext())
{
ServiceRequestResource serviceResource = serviceRequestResources.Current;
iService.AddResource(serviceResource.GetName(), serviceResource.GetValue());
}
ServiceDescriptor serviceDescriptor = resourceManager.RequiredServiceDescriptorBasedOnName(service.GetService());
iService.SetServiceDescriptor(serviceDescriptor);
ResourceUtils.Resolve(iService);
return iService;
}