public static IGlobalConfiguration <TStorage> UseStorage <TStorage>(this IGlobalConfiguration configuration, TStorage storage) where TStorage : LayimStorage
        {
            Error.ThrowIfNull(configuration, nameof(configuration));
            Error.ThrowIfNull(storage, nameof(storage));

            return(configuration.Use(storage, x => LayimStorage.Current = x));
        }
Example #2
0
 public static IGlobalConfiguration<TStorage> UseStorage<TStorage>(
     [NotNull] this IGlobalConfiguration configuration,
     [NotNull] TStorage storage)
     where TStorage : JobStorage
 {
     if (configuration == null) throw new ArgumentNullException(nameof(configuration));
     if (storage == null) throw new ArgumentNullException(nameof(storage));
     return configuration.Use(storage, x => JobStorage.Current = x);
 }
        public static IGlobalConfiguration <TStorage> UseStorage <TStorage>(this IGlobalConfiguration configuration, TStorage storage)
            where TStorage : DataStorage
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (storage == null)
            {
                throw new ArgumentNullException(nameof(storage));
            }

            return(configuration.Use(storage, x => DataStorage.Current = x));
        }
Example #4
0
        public static IGlobalConfiguration <TFilter> UseFilter <TFilter>(
            [NotNull] this IGlobalConfiguration configuration,
            [NotNull] TFilter filter)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (filter == null)
            {
                throw new ArgumentNullException("filter");
            }

            return(configuration.Use(filter, x => GlobalJobFilters.Filters.Add(x)));
        }
Example #5
0
        public static IGlobalConfiguration <TActivator> UseActivator <TActivator>(
            [NotNull] this IGlobalConfiguration configuration,
            [NotNull] TActivator activator)
            where TActivator : JobActivator
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (activator == null)
            {
                throw new ArgumentNullException("activator");
            }

            return(configuration.Use(activator, x => JobActivator.Current = x));
        }
Example #6
0
        public static IGlobalConfiguration <TResolution> UseSchedulerResolution <TResolution>(
            [NotNull] this IGlobalConfiguration configuration,
            [NotNull] TResolution resolution)
            where TResolution : SchedulerResolution
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (resolution == null)
            {
                throw new ArgumentNullException("resolution");
            }

            return(configuration.Use(resolution, x => SchedulerResolution.Current = x));
        }
Example #7
0
        public static IGlobalConfiguration <TLogProvider> UseLogProvider <TLogProvider>(
            [NotNull] this IGlobalConfiguration configuration,
            [NotNull] TLogProvider provider)
            where TLogProvider : ILogProvider
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            return(configuration.Use(provider, x => LogProvider.SetCurrentLogProvider(x)));
        }
        public static IGlobalConfiguration <TQueueHost> UseQueueHost <TQueueHost>(
            [NotNull] this IGlobalConfiguration configuration,
            [NotNull] TQueueHost host)
            where TQueueHost : QueueHost
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            return(configuration.Use(host, x => QueueHost.Current = x));
        }
        public static IGlobalConfiguration <TConfiguration> UseConfiguration <TConfiguration>(
            [NotNull] this IGlobalConfiguration configuration,
            [NotNull] TConfiguration config)
            where TConfiguration : IConfigurationRoot
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            return(configuration.Use(config, x => Configuration.Current = x));
        }