/// <summary> /// 导入 /// </summary> public static void Importe() { if (Instance != null) { return; } string path = ConfigurationManager.Root.GetValue("contentRoot", Environment.CurrentDirectory); if (!string.IsNullOrEmpty(ZeroApplication.Config.AddInPath)) { path = IOHelper.CheckPath(path, ZeroApplication.Config.AddInPath); } ZeroTrace.WriteInfo("AddIn", path); Instance = new AddInImporter(); IocHelper.ServiceCollection.AddSingleton(pro => Instance); // 通过容器对象将宿主和部件组装到一起。 DirectoryCatalog directoryCatalog = new DirectoryCatalog(path); var container = new CompositionContainer(directoryCatalog); container.ComposeParts(Instance); foreach (var reg in Instance.Registers) { ZeroTrace.WriteInfo("AddIn", reg.GetType().Assembly.FullName); } }
/// <summary> /// 导入 /// </summary> public static void Importe() { if (Instance != null) { return; } Instance = new AddInImporter(); IocHelper.ServiceCollection.AddSingleton(pro => Instance); CheckSystemAddIn(); CheckAddIn(); }