コード例 #1
0
 /// <summary>
 /// Create client adapter
 /// </summary>
 /// <param name="product"></param>
 /// <param name="onError"></param>
 /// <param name="transportSetting"></param>
 /// <returns></returns>
 private Task <IClient> CreateAdapterAsync(string product, Action onError,
                                           ITransportSettings transportSetting = null)
 {
     if (_cs != null && string.IsNullOrEmpty(_cs.ModuleId))
     {
         return(DeviceClientAdapter.CreateAsync(product, _cs, transportSetting,
                                                _timeout, RetryPolicy, onError, _logger));
     }
     return(ModuleClientAdapter.CreateAsync(product, _cs, transportSetting,
                                            _timeout, RetryPolicy, onError, _logger));
 }
コード例 #2
0
 /// <summary>
 /// Create client adapter
 /// </summary>
 /// <param name="product"></param>
 /// <param name="onError"></param>
 /// <param name="transportSetting"></param>
 /// <returns></returns>
 private Task<IClient> CreateAdapterAsync(string product, Action onError,
     ITransportSettings transportSetting = null) {
     if (string.IsNullOrEmpty(ModuleId)) {
         if (_cs == null) {
             throw new InvalidConfigurationException(
                 "No connection string for device client specified.");
         }
         return DeviceClientAdapter.CreateAsync(product, _cs, DeviceId,
             transportSetting, _timeout, RetryPolicy, onError, _logger);
     }
     return ModuleClientAdapter.CreateAsync(product, _cs, DeviceId, ModuleId,
         transportSetting, _timeout, RetryPolicy, onError, _logger);
 }