private ModelApplicationBase GetMasterModel(bool recreate) { var modelApplicationBase = GetMasterModelCore(recreate); ModelApplicationBases.Add(modelApplicationBase, XafTypesInfo.Instance); TypeInfo.AssignAsInstance(); return(modelApplicationBase); }
protected override void Dispose(bool disposing) { try { if (CurrentObject != null) CurrentObject.Changed -= CurrentObjectOnChanged; if (_objectSpace != null) { _objectSpace.Committing -= ObjectSpaceOnCommitting; _objectSpace = null; } } finally { base.Dispose(disposing); _typeInfo.AssignAsInstance(); } }
XpandApplicationModulesManager CreateModulesManager(XafApplication application, string configFileName, string assembliesPath, ITypesInfo typesInfo) { if (!string.IsNullOrEmpty(configFileName)) { bool isWebApplicationModel = String.Compare(Path.GetFileNameWithoutExtension(configFileName), "web", StringComparison.OrdinalIgnoreCase) == 0; if (string.IsNullOrEmpty(assembliesPath)) { assembliesPath = Path.GetDirectoryName(configFileName); if (isWebApplicationModel) { assembliesPath = Path.Combine(assembliesPath + "", "Bin"); } } } ReflectionHelper.AddResolvePath(assembliesPath); ITypesInfo synchronizeTypesInfo = null; try { var applicationModulesManager = new XpandApplicationModulesManager(new ControllersManager(), assembliesPath); if (application != null) { foreach (ModuleBase module in application.Modules) { applicationModulesManager.AddModule(module); } applicationModulesManager.Security = application.Security; applicationModulesManager.AddAdditionalModules(application); } if (!string.IsNullOrEmpty(configFileName)) { applicationModulesManager.AddModuleFromAssemblies(GetModulesFromConfig(application)); } var loadTypesInfo = typesInfo != XafTypesInfo.Instance; synchronizeTypesInfo = XafTypesInfo.Instance; typesInfo.AssignAsInstance(); applicationModulesManager.TypesInfo = typesInfo; var runtimeMode = InterfaceBuilder.RuntimeMode; InterfaceBuilder.RuntimeMode = false; applicationModulesManager.Load(typesInfo, loadTypesInfo); InterfaceBuilder.RuntimeMode = runtimeMode; return(applicationModulesManager); } finally { synchronizeTypesInfo.AssignAsInstance(); ReflectionHelper.RemoveResolvePath(assembliesPath); } }
XpandApplicationModulesManager CreateModulesManager(XafApplication application, string configFileName, string assembliesPath, ITypesInfo typesInfo) { if (!string.IsNullOrEmpty(configFileName)) { bool isWebApplicationModel = String.Compare(Path.GetFileNameWithoutExtension(configFileName), "web", StringComparison.OrdinalIgnoreCase) == 0; if (string.IsNullOrEmpty(assembliesPath)) { assembliesPath = Path.GetDirectoryName(configFileName); if (isWebApplicationModel) { assembliesPath = Path.Combine(assembliesPath + "", "Bin"); } } } ReflectionHelper.AddResolvePath(assembliesPath); ITypesInfo synchronizeTypesInfo = null; try { var applicationModulesManager = new XpandApplicationModulesManager(new ControllersManager(), assembliesPath); if (application != null) { foreach (ModuleBase module in application.Modules) { applicationModulesManager.AddModule(module); } applicationModulesManager.Security = application.Security; } if (!string.IsNullOrEmpty(configFileName)) { applicationModulesManager.AddModuleFromAssemblies(GetModulesFromConfig(application)); } var loadTypesInfo = typesInfo != XafTypesInfo.Instance; synchronizeTypesInfo = XafTypesInfo.Instance; typesInfo.AssignAsInstance(); applicationModulesManager.TypesInfo = typesInfo; applicationModulesManager.Load(typesInfo, loadTypesInfo); return applicationModulesManager; } finally { synchronizeTypesInfo.AssignAsInstance(); ReflectionHelper.RemoveResolvePath(assembliesPath); } }
void FormOnActivated(object sender, EventArgs eventArgs) { ITypesInfo typesInfo = _modelApplicationBases[_masterModel]; typesInfo.AssignAsInstance(); }