public BaseJobUpdater GetUpdater(JobType.UpdateInfoType type) { //if (updateWorkers.ContainsKey(type)) return updateWorkers[type]; IConnectionManager connManager = new ConnectionManager(logger, encryptionManager); InstanceInfoUpdater instanceInfoUpdater = new InstanceInfoUpdater(logger); IInstanceDataCollector instanceDataCollector = DependencyConfig.Initialize().Resolve <IInstanceDataCollector>( new ParameterOverride("connManager", connManager), new ParameterOverride("resourceManager", resourceManager), new ParameterOverride("logger", logger)); //logger.Debug("instanceDataCollector = "+ instanceDataCollector.GetHashCode()); if (type == JobType.UpdateInfoType.Full) { return(new FullJobUpdater(instanceInfoUpdater, logger, unitOfWork, connManager, instanceDataCollector)); } if (type == JobType.UpdateInfoType.CheckStatus) { return(new StatusJobUpdater(instanceInfoUpdater, logger, unitOfWork, connManager, instanceDataCollector)); } if (type == JobType.UpdateInfoType.RemoveInstances) { return(new RemoveJobUpdater(instanceInfoUpdater, logger, unitOfWork, connManager, instanceDataCollector)); } return(null); }
public testService() { IUnityContainer unity = DependencyConfig.Initialize(); logger = ServiceLocator.Current.GetInstance <ISLogger>(); encryptionManager = ServiceLocator.Current.GetInstance <IEncryptionManager>(); resourceManager = ServiceLocator.Current.GetInstance <IResourceManager>(); unitOfWork = unity.Resolve <IUnitOfWork>(new ParameterOverride("context", new MsSqlMonitorEntities())); IConnectionManager connManager = ServiceLocator.Current.GetInstance <IConnectionManager>(); sqlTaskScheduler = new SQLTaskScheduler(logger, resourceManager, unitOfWork, connManager, encryptionManager); }
protected override void OnStart(string[] args) { IUnityContainer unity = DependencyConfig.Initialize(); logger = ServiceLocator.Current.GetInstance <ISLogger>(); resourceManager = ServiceLocator.Current.GetInstance <IResourceManager>(); connManager = ServiceLocator.Current.GetInstance <IConnectionManager>(); encryptionManager = ServiceLocator.Current.GetInstance <IEncryptionManager>(); logger.Debug("collection service started"); unitOfWork = unity.Resolve <IUnitOfWork>(new ParameterOverride("context", new MsSqlMonitorEntities())); try { WCFHost = new ServiceHost(this, new Uri[] { new Uri(WCFADRESS) }); var behaviour = WCFHost.Description.Behaviors.Find <ServiceBehaviorAttribute>(); behaviour.InstanceContextMode = InstanceContextMode.Single; WCFHost.AddServiceEndpoint(typeof(IWCFContract), new NetTcpBinding(), WCFSERVICE); WCFHost.Open(); } catch (Exception e) { WCFHost = null; logger.Error("WCF open error ", e); } try { sqlTaskScheduler = new SQLTaskScheduler(logger, resourceManager, unitOfWork, connManager, encryptionManager); sqlTaskScheduler.Start(); } catch (Exception e) { logger.Error("start service error ", e); } // }