public Installer() { InitializeComponent(); Container container = ContainerConfigura(); RegistrarServicosPrefeitura.Initialize(container); JobStorage.Current = new MySqlStorage("GerenciadorCrawler"); var activator = new SimpleInjectorJobActivator(container); _server = new BackgroundJobServer(new BackgroundJobServerOptions { Activator = activator, ServerName = "Monitor Serviço Nota Fiscal" }, JobStorage.Current); var recurringJobs = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(a => a.GetTypes()) .Where( type => typeof(IRecurringJob).IsAssignableFrom(type) && !type.IsAbstract && !type.IsGenericTypeDefinition && !type.IsInterface); container.RegisterCollection <IRecurringJob>(recurringJobs); container.Verify(); }
public void ActivateJobCallsSimpleInjector() { var theJob = new TestJob(); container.RegisterSingle<TestJob>(theJob); var activator = new SimpleInjectorJobActivator(container); var result = activator.ActivateJob(typeof(TestJob)); Assert.AreEqual(theJob, result); }
public void ActivateJobCallsSimpleInjector() { var theJob = new TestJob(); container.RegisterInstance <TestJob>(theJob); var activator = new SimpleInjectorJobActivator(container); var result = activator.ActivateJob(typeof(TestJob)); Assert.AreEqual(theJob, result); }
public void ConfigureServices(IServiceCollection services) { var builder = new ConfigurationBuilder() .SetBasePath(Env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables(); Configuration = builder.Build(); var connectionString = Configuration.GetConnectionString("DatabaseContext"); var simpleInjector = new SimpleInjectorJobActivator(Container); services.AddHangfire(config => config.UseSqlServerStorage(connectionString) .UseActivator(simpleInjector) .UseFilter(new SimpleInjectorAsyncScopeFilterAttribute(Container))); services.IntegrateSimpleInjector(Container); }
public void CtorThrowsAnExceptionWhenContainerIsNull() { // ReSharper disable once UnusedVariable var activator = new SimpleInjectorJobActivator(container); }
public void CtorThrowsAnExceptionWhenContainerIsNull() { // ReSharper disable once UnusedVariable var activator = new SimpleInjectorJobActivator(null); }