private void ConfigureAutoShutdown(GenericPollerConfiguration config)
 {
     this._totalStopwatch = new Stopwatch();
     _autoShutdownMinutes = new Random().Next((int)config.AutoShutdownMinutesMin, (int)config.AutoShutdownMinutesMax);
     if (_autoShutdownMinutes == 0)
     {
         _autoShutdownMinutes = null;
     }
 }
Example #2
0
        private static IUnityContainer CreateUnityContainer()
        {
            var genericPollerConfiguration = new GenericPollerConfiguration();

            UnityContainer container = new UnityContainer();

            container.RegisterInstance <GenericPollerConfiguration>(genericPollerConfiguration);
            container.RegisterType <IAssemblyResolver, AssemblyResolver>(new ContainerControlledLifetimeManager());
            container.RegisterType <IJSonRPCHelper, JSonRPCHelper>();
            container.RegisterType <IPollHandlerToolkit, PollHandlerToolkit>();
            //container.RegisterType<ILogEntryBuilder, LogEntryBuilder>(new InjectionConstructor(applicationName));
            //container.RegisterType<ILogger, Logger>();
            container.RegisterType <ILogger, ContextLogger>(new ContainerControlledLifetimeManager());
            container.RegisterType <ITracer, ContextTracer>(new ContainerControlledLifetimeManager());
            container.RegisterType <IAssemblyLocator, AssemblyLocator>(new InjectionConstructor(genericPollerConfiguration.PollerDirectory));
            container.RegisterInstance <dynamic>("LoggingServiceBusClient", new ServiceBusClient(genericPollerConfiguration.ServiceBusExecuteEndpoint, "Logging"));
            return(container);
        }
Example #3
0
 public ContextLogger([Dependency("LoggingServiceBusClient")] dynamic loggingServiceBusClient, GenericPollerConfiguration genericPollerConfiguration)
 {
     _loggingServiceBusClient    = loggingServiceBusClient;
     _genericPollerConfiguration = genericPollerConfiguration;
     _logLevel = (LogEntrySeverity)_genericPollerConfiguration.LogLevel;
 }