public void Run() { _logMgr = CreateLogMgr(); if (_logMgr == null) { throw new NullReferenceException("LogMgr can not be null."); } _logger = _logMgr.GetLogger("BootStrapper"); _logger.Info("Run."); AggregateCatalog catalog = CreateAgregateCatalog(); if (catalog == null) { FatalError(new NullReferenceException("AggregateCatalog can not be null.")); } _container = new CompositionContainer(catalog); if (_container == null) { FatalError(new NullReferenceException("CompositionContainer can not be null.")); } IEventMgr eventMgr = CreateEventMgr(); if (eventMgr == null) { FatalError(new NullReferenceException("EventMgr can not be null.")); } PlugginMgr plugginMgr = CreatePlugginMgr(); if (plugginMgr == null) { FatalError(new NullReferenceException("PlugginMgr can not be null.")); } _container.ComposeExportedValue <ILogMgr>(LogMgr); _container.ComposeExportedValue <IEventMgr>(eventMgr); _container.ComposeExportedValue <IServiceMgr>(new ServiceMgrImpl(_logMgr, _container)); IServiceMgr serviceMgr = _container.GetExportedValue <IServiceMgr>(); ServiceMgr.SetServiceMgrProvider(() => serviceMgr); _container.ComposeExportedValue <IPlugginMgr>(plugginMgr); _container.ComposeParts(plugginMgr); RegisterServices(); StartWork(); }