Exemplo n.º 1
0
        public ConfigurationMiddleware(
            RequestDelegate next,
            IDictionary <string, object> properties)
        {
            var injected = properties?.ContainsKey("HangfireConfiguration") ?? false;

            if (injected)
            {
                _configuration = (HangfireConfiguration)properties["HangfireConfiguration"];
            }
            else
            {
                _configuration = new HangfireConfiguration();
                if (properties?.ContainsKey("HangfireConfigurationOptions") ?? false)
                {
                    _configuration.UseOptions((ConfigurationOptions)properties["HangfireConfigurationOptions"]);
                }
            }

            _options = _configuration.Options().ConfigurationOptions();

            _configurationApi = _configuration.ConfigurationApi();
            if (_options.PrepareSchemaIfNecessary)
            {
                using (var c = _options.ConnectionString.CreateConnection())
                    HangfireConfigurationSchemaInstaller.Install(c);
            }
        }
Exemplo n.º 2
0
 public DynamicHangfireDashboardsMiddleware(
     RequestDelegate next,
     ConfigurationOptions options,
     DashboardOptions dashboardOptions)
 {
     _next             = next;
     _dashboardOptions = dashboardOptions;
     _configuration    = new HangfireConfiguration();
     _configuration.UseOptions(options);
 }