当前位置: 首页>>代码示例>>C#>>正文


C# ApplicationModulesManager.AddModule方法代码示例

本文整理汇总了C#中ApplicationModulesManager.AddModule方法的典型用法代码示例。如果您正苦于以下问题:C# ApplicationModulesManager.AddModule方法的具体用法?C# ApplicationModulesManager.AddModule怎么用?C# ApplicationModulesManager.AddModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ApplicationModulesManager的用法示例。


在下文中一共展示了ApplicationModulesManager.AddModule方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

        public override void Setup(ApplicationModulesManager moduleManager) {
            base.Setup(moduleManager);
            var businessClassesList = GetAdditionalClasses(moduleManager);
            WCTypesInfo.Instance.Register(businessClassesList);
            if (Application == null || GetPath() == null)
                return;
            Application.SettingUp += ApplicationOnSettingUp;
            if (FullConnectionString != null) {
                var xpoMultiDataStoreProxy = new SqlMultiDataStoreProxy(FullConnectionString, GetReflectionDictionary());
                using (var dataLayer = new SimpleDataLayer(xpoMultiDataStoreProxy)) {
                    using (var session = new Session(dataLayer)) {
                        using (var unitOfWork = new UnitOfWork(session.DataLayer)) {
                            RunUpdaters(session);
                            AddDynamicModules(moduleManager, unitOfWork);
                        }
                    }
                }
            } else {
                var assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(assembly => assembly.ManifestModule.ScopeName.EndsWith(CompileEngine.XpandExtension));
                foreach (var assembly1 in assemblies) {
                    moduleManager.AddModule(assembly1.GetTypes().Where(type => typeof(ModuleBase).IsAssignableFrom(type)).Single());
                }
            }


            Application.SetupComplete += ApplicationOnSetupComplete;

        }
开发者ID:testexpand,项目名称:eXpand,代码行数:28,代码来源:WorldCreatorModuleBase.cs

示例2: AddDynamicModules

 public void AddDynamicModules(ApplicationModulesManager moduleManager, UnitOfWork unitOfWork){
     Type assemblyInfoType = TypesInfo.Instance.PersistentAssemblyInfoType;
     List<IPersistentAssemblyInfo> persistentAssemblyInfos =
         new XPCollection(unitOfWork, assemblyInfoType).Cast<IPersistentAssemblyInfo>().Where(info => !info.DoNotCompile &&
             moduleManager.Modules.Where(@base => @base.Name == "Dynamic" + info.Name + "Module").FirstOrDefault() ==null).ToList();
     _definedModules = new CompileEngine().CompileModules(persistentAssemblyInfos,GetPath());
     foreach (var definedModule in _definedModules){
         moduleManager.AddModule(definedModule);
     }
     unitOfWork.CommitChanges();
 }
开发者ID:akingunes,项目名称:eXpand,代码行数:11,代码来源:WorldCreatorModuleBase.cs

示例3: Setup

        public override void Setup(ApplicationModulesManager moduleManager) {
            base.Setup(moduleManager);
            WCTypesInfo.Instance.Register(GetAdditionalClasses(moduleManager));
            if (Application == null || GetPath() == null||!RuntimeMode)
                return;
            if (!string.IsNullOrEmpty(ConnectionString) || Application.ObjectSpaceProvider is DataServerObjectSpaceProvider) {
                using (var unitOfWork = GetUnitOfWork()) {
                    RunUpdaters(unitOfWork);
                    AddDynamicModules(moduleManager, unitOfWork);
                    if (unitOfWork.DataLayer != null) unitOfWork.DataLayer.Dispose();
                }
            } else {
                var assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(assembly => assembly.ManifestModule.ScopeName.EndsWith(CompileEngine.XpandExtension));
                foreach (var assembly1 in assemblies) {
                    moduleManager.AddModule(assembly1.GetTypes().Single(type => typeof(ModuleBase).IsAssignableFrom(type)));
                }
            }
            Application.LoggedOn+=ApplicationOnLoggedOn;
            

        }
开发者ID:kamchung322,项目名称:eXpand,代码行数:21,代码来源:WorldCreatorModuleBase.cs

示例4: ValidateBOModel

        bool ValidateBOModel(IPersistentAssemblyInfo persistentAssemblyInfo, Type compileCore) {
            if (persistentAssemblyInfo.ValidateModelOnCompile) {
                var instance = XafTypesInfo.Instance;
                try{
                    var typesInfo = new TypesInfoBuilder.TypesInfo();
                    typesInfo.AddEntityStore(new NonPersistentEntityStore(typesInfo));
                    typesInfo.AddEntityStore(new XpoTypeInfoSource(typesInfo));

                    typesInfo.AssignAsInstance();
                    typesInfo.LoadTypes(compileCore.Assembly);
                    var applicationModulesManager = new ApplicationModulesManager();
                    applicationModulesManager.AddModule(compileCore);
                    applicationModulesManager.Load(typesInfo, true);
                }
                catch (Exception exception){
                    persistentAssemblyInfo.CompileErrors = exception.ToString();
                    return false;
                }
                finally{
                    instance.AssignAsInstance();
                }
            }
            return true;
        }
开发者ID:kamchung322,项目名称:eXpand,代码行数:24,代码来源:CompileEngine.cs

示例5: AddDynamicModules

 void AddDynamicModules(ApplicationModulesManager moduleManager, UnitOfWork unitOfWork) {
     unitOfWork.LockingOption = LockingOption.None;
     Type assemblyInfoType = WCTypesInfo.Instance.FindBussinessObjectType<IPersistentAssemblyInfo>();
     List<IPersistentAssemblyInfo> persistentAssemblyInfos =
         new XPCollection(unitOfWork, assemblyInfoType).OfType<IPersistentAssemblyInfo>().Where(IsValidAssemblyInfo(moduleManager)).ToList();
     _dynamicModuleTypes = new CompileEngine().CompileModules(persistentAssemblyInfos, GetPath());
     foreach (var definedModule in _dynamicModuleTypes) {
         moduleManager.AddModule(definedModule);
         var module = moduleManager.Modules.FindModule(definedModule);
         moduleManager.ControllersManager.RegisterControllerTypes(module.GetControllerTypes().ToArray());
     }
     unitOfWork.CommitChanges();
 }
开发者ID:kamchung322,项目名称:eXpand,代码行数:13,代码来源:WorldCreatorModuleBase.cs


注:本文中的ApplicationModulesManager.AddModule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。