public override void ApplyToConfig(JobHostConfigurationBuilder configBuilder)
        {
            if (configBuilder == null)
            {
                throw new ArgumentNullException("configBuilder");
            }

            var apiHubConfig = configBuilder.ApiHubConfiguration;

            string connectionString = null;
            if (!string.IsNullOrEmpty(this.Connection))
            {
                connectionString = Utility.GetAppSettingOrEnvironmentValue(Connection);
            }

            apiHubConfig.AddKeyPath(this.Key, connectionString);
        }
        public override void ApplyToConfig(JobHostConfigurationBuilder configBuilder)
        {
            if (configBuilder == null)
            {
                throw new ArgumentNullException("configBuilder");
            }

            var apiHubConfig = configBuilder.ApiHubConfiguration;

            string connectionString = null;

            if (!string.IsNullOrEmpty(this.Connection))
            {
                connectionString = Utility.GetAppSettingOrEnvironmentValue(Connection);
            }

            apiHubConfig.AddKeyPath(this.Key, connectionString);
        }
        public override void ApplyToConfig(JobHostConfigurationBuilder configBuilder)
        {
            if (configBuilder == null)
            {
                throw new ArgumentNullException("configBuilder");
            }
            EventHubConfiguration eventHubConfig = configBuilder.EventHubConfiguration;

            string connectionString = null;

            if (!string.IsNullOrEmpty(Connection))
            {
                connectionString = Utility.GetAppSettingOrEnvironmentValue(Connection);
            }

            if (this.IsTrigger)
            {
                string eventProcessorHostName = Guid.NewGuid().ToString();

                string storageConnectionString = configBuilder.Config.StorageConnectionString;

                var eventProcessorHost = new Microsoft.ServiceBus.Messaging.EventProcessorHost(
                    eventProcessorHostName,
                    this.Path,
                    Microsoft.ServiceBus.Messaging.EventHubConsumerGroup.DefaultGroupName,
                    connectionString,
                    storageConnectionString);

                eventHubConfig.AddEventProcessorHost(this.Path, eventProcessorHost);
            }
            else
            {
                var client = Microsoft.ServiceBus.Messaging.EventHubClient.CreateFromConnectionString(
                    connectionString, this.Path);

                eventHubConfig.AddEventHubClient(this.Path, client);
            }
        }
        public override void ApplyToConfig(JobHostConfigurationBuilder configBuilder)
        {
            if (configBuilder == null)
            {
                throw new ArgumentNullException("configBuilder");
            }
            EventHubConfiguration eventHubConfig = configBuilder.EventHubConfiguration;

            string connectionString = null;
            if (!string.IsNullOrEmpty(Connection))
            {
                connectionString = Utility.GetAppSettingOrEnvironmentValue(Connection);
            }

            if (this.IsTrigger)
            {
                string eventProcessorHostName = Guid.NewGuid().ToString();

                string storageConnectionString = configBuilder.Config.StorageConnectionString;

                var eventProcessorHost = new Microsoft.ServiceBus.Messaging.EventProcessorHost(
                     eventProcessorHostName,
                     this.Path,
                     Microsoft.ServiceBus.Messaging.EventHubConsumerGroup.DefaultGroupName,
                     connectionString,
                     storageConnectionString);

                eventHubConfig.AddEventProcessorHost(this.Path, eventProcessorHost);
            }
            else
            {                
                var client = Microsoft.ServiceBus.Messaging.EventHubClient.CreateFromConnectionString(
                    connectionString, this.Path);

                eventHubConfig.AddEventHubClient(this.Path, client);
            }
        }        
        // Bindings may require us to update JobHostConfiguration. 
        private static void ApplyBindingConfiguration(Collection<FunctionDescriptor> functions, JobHostConfiguration hostConfig)
        {
            JobHostConfigurationBuilder builder = new JobHostConfigurationBuilder(hostConfig);

            foreach (var func in functions)
            {
                foreach (var metadata in func.Metadata.InputBindings.Concat(func.Metadata.OutputBindings))
                {
                    metadata.ApplyToConfig(builder);
                }
            }
            builder.Done();
        }