예제 #1
0
        public DeviceService(IServicesConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            IoTHubConnectionHelper.CreateUsingHubConnectionString(
                config.IoTHubConnString,
                conn => { this.serviceClient = ServiceClient.CreateFromConnectionString(conn); });
        }
        public DeviceConfigurationService(
            IServicesConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            IoTHubConnectionHelper.CreateUsingHubConnectionString(config.IoTHubConnectionString, (conn) =>
            {
                _registryManager = RegistryManager.CreateFromConnectionString(conn);
            });
        }
예제 #3
0
        public Devices(
            IServicesConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            IoTHubConnectionHelper.CreateUsingHubConnectionString(config.IoTHubConnString, (conn) =>
            {
                this.registry       = RegistryManager.CreateFromConnectionString(conn);
                this.ioTHubHostName = IotHubConnectionStringBuilder.Create(conn).HostName;
            });
        }
예제 #4
0
        public Jobs(IServicesConfig config, IDeviceProperties deviceProperties)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            this.deviceProperties = deviceProperties;

            IoTHubConnectionHelper.CreateUsingHubConnectionString(
                config.IoTHubConnString,
                conn => { this.jobClient = JobClient.CreateFromConnectionString(conn); });

            IoTHubConnectionHelper.CreateUsingHubConnectionString(
                config.IoTHubConnString,
                conn => { this.registryManager = RegistryManager.CreateFromConnectionString(conn); });
        }
예제 #5
0
        public Jobs(
            IServicesConfig config,
            IConfigService configService)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            IoTHubConnectionHelper.CreateUsingHubConnectionString(
                config.IoTHubConnString,
                conn => { this.jobClient = JobClient.CreateFromConnectionString(conn); });

            IoTHubConnectionHelper.CreateUsingHubConnectionString(
                config.IoTHubConnString,
                conn => { this.registryManager = RegistryManager.CreateFromConnectionString(conn); });

            this.configService = configService;
        }
        public DeviceService(ITenantConnectionHelper tenantConnectionHelper)
        {
            string iotHubConnectionString = string.Empty;

            try
            {
                iotHubConnectionString = tenantConnectionHelper.GetIotHubConnectionString();
            }
            catch (Autofac.Core.DependencyResolutionException re)
            {
                throw new Exception("Unable to get the IotHub Connection String from the tenantConnectionHelper. This may be caused by a missing tenant id in the request, or a misconfigured App Configuration.", re);
            }

            if (string.IsNullOrEmpty(iotHubConnectionString))
            {
                throw new Exception("The IotHubConnectionString returned by App Config was null or empty.");
            }

            IoTHubConnectionHelper.CreateUsingHubConnectionString(
                iotHubConnectionString,
                conn => { this.serviceClient = ServiceClient.CreateFromConnectionString(conn); });
        }