示例#1
0
        private bool IsAcceptableCreator <T>(
            ComponentCreatorBase creator) where T : IExtComponent
        {
            if (!creator.ComponentType.GetInterfaces().Contains(typeof(T)))
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        public CoreContext()
        {
            SharedContext.I  = this;
            ComponentFactory =
                new AbCatComponentFactory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plug-ins"));
            try
            {
                ComponentFactory.Init();
            }
            catch (Exception e)
            {
                var ex = new Exception("An error occurred on initializing ComponentFactory.", e);
                MessageBox.Show(ex.CollectExceptionDetails());
                throw ex;
            }

            _dbPluginCreatorAttribute = ComponentFactory.GetCreators <IDbContainer>().First();
            LoggerFactory             = ComponentFactory.CreateActual <ILoggerFactory>();
            LoggerFactory.Init();
            MainLog     = LoggerFactory.GetLogger("MainLog");
            DbContainer = CreateDbContainer(true);
        }