Beispiel #1
0
        /// <summary>
        /// Registers the specified extension with the <see cref="JobHostConfiguration"/>
        /// </summary>
        /// <typeparam name="TExtension">The type of extension being registered.</typeparam>
        /// <param name="config">The <see cref="JobHostConfiguration"/> to register the extension with.</param>
        /// <param name="extension">The extension to register.</param>
        public static void RegisterExtension <TExtension>(this JobHostConfiguration config, TExtension extension)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            IExtensionRegistry extensions = config.GetService <IExtensionRegistry>();

            extensions.RegisterExtension <TExtension>(extension);
        }
Beispiel #2
0
        /// <summary>
        /// Add ApiHub configuration to <see cref="JobHostConfiguration"/>
        /// </summary>
        /// <param name="config">current <see cref="JobHostConfiguration"/></param>
        /// <param name="apiHubConfiguration">Instance of <see cref="ApiHubConfiguration"/></param>
        public static void UseApiHub(this JobHostConfiguration config, ApiHubConfiguration apiHubConfiguration = null)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (apiHubConfiguration == null)
            {
                apiHubConfiguration = new ApiHubConfiguration();
            }
            IExtensionRegistry extensions = config.GetService <IExtensionRegistry>();

            extensions.RegisterExtension <IExtensionConfigProvider>(apiHubConfiguration);
        }
        public static void UseEventHub(this JobHostConfiguration config, EventHubConfiguration eventHubConfig)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            if (eventHubConfig == null)
            {
                throw new ArgumentNullException("eventHubConfig");
            }

            IExtensionRegistry extensions = config.GetService <IExtensionRegistry>();

            extensions.RegisterExtension <IExtensionConfigProvider>(eventHubConfig);
        }
        /// <summary>
        /// Enables use of ServiceBus job extensions
        /// </summary>
        /// <param name="config">The <see cref="JobHostConfiguration"/> to configure.</param>
        /// <param name="serviceBusConfig">The <see cref="ServiceBusConfiguration"></see> to use./></param>
        public static void UseServiceBus(this JobHostConfiguration config, ServiceBusConfiguration serviceBusConfig)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            if (serviceBusConfig == null)
            {
                throw new ArgumentNullException("serviceBusConfig");
            }

            ServiceBusExtensionConfig extensionConfig = new ServiceBusExtensionConfig(serviceBusConfig);

            IExtensionRegistry extensions = config.GetService <IExtensionRegistry>();

            extensions.RegisterExtension <IExtensionConfigProvider>(extensionConfig);
        }