Пример #1
0
        private void LoadCoreModule(IServiceContext tc, ModuleUpdateAction action)
        {
            Debug.Assert(tc != null);

            var a         = typeof(ModuleEntity).Assembly;
            var resources = this.GetResourcesInAssembly(a);

            this.InitializeResources(tc, resources, action);

            //加载核心模块数据
            if (action == ModuleUpdateAction.ToInstall)
            {
                LoggerProvider.EnvironmentLogger.Info(() => "Importing data for the Core Module...");
                var importer = new Entity.XmlDataImporter(tc, this.Name);
                foreach (var resPath in s_coreInitDataFiles)
                {
                    using (var resStream = a.GetManifestResourceStream(resPath))
                    {
                        LoggerProvider.EnvironmentLogger.Info(() => "Importing data file: [" + resPath + "]");
                        importer.Import(resStream);
                        resStream.Close();
                    }
                }
            }
        }
Пример #2
0
        private void ImportDataFiles(IServiceContext scope, string[] files)
        {
            var importer = new Entity.XmlDataImporter(scope, this.Name);

            foreach (var dataFile in files)
            {
                var dataFilePath = System.IO.Path.Combine(this.Path, dataFile);
                LoggerProvider.EnvironmentLogger.Info(() => "Importing data file: [" + dataFilePath + "]");
                importer.Import(dataFilePath);
            }
        }