AzureIoTHubConnectedService.AzureIoTHubAccountProviderGrid.CreateServiceInstance C# (CSharp) Method

CreateServiceInstance() private static method

private static CreateServiceInstance ( IAzureIoTHub iotHubAccount ) : ConnectedServiceInstance
iotHubAccount IAzureIoTHub
return ConnectedServiceInstance
        private static ConnectedServiceInstance CreateServiceInstance(IAzureIoTHub iotHubAccount)
        {
            ConnectedServiceInstance instance = new ConnectedServiceInstance();

            instance.InstanceId = iotHubAccount.Id;
            instance.Name = iotHubAccount.Properties["IoTHubName"];

            foreach (var property in iotHubAccount.Properties)
            {
                instance.Metadata.Add(property.Key, property.Value);
            }

            instance.Metadata.Add("IoTHubAccount", iotHubAccount);
            instance.Metadata.Add("Cancel", false);
            instance.Metadata.Add("TPM", false);

            return instance;
        }

Usage Example

コード例 #1
0
        public override async Task <IEnumerable <ConnectedServiceInstance> > EnumerateServiceInstancesAsync(CancellationToken ct)
        {
            IEnumerable <IAzureIoTHub> hubs = await this.Authenticator.GetAzureIoTHubs(this.iotHubAccountManager, ct).ConfigureAwait(false);

            ct.ThrowIfCancellationRequested();
            return(hubs.Select(p => AzureIoTHubAccountProviderGrid.CreateServiceInstance(p)).ToList());
        }
All Usage Examples Of AzureIoTHubConnectedService.AzureIoTHubAccountProviderGrid::CreateServiceInstance