本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}