public static XPCustomMemberInfo[] CreateMembers(WorldCreatorModule worldCreatorModule) { if (_members.Length == 0 && InterfaceBuilder.RuntimeMode) { var worldCreatorObjectSpaceProvider = WorldCreatorObjectSpaceProvider.Create(worldCreatorModule.Application, false); using (var objectSpace = worldCreatorObjectSpaceProvider.CreateObjectSpace()) { _members = CreateMembers(objectSpace); } } return(_members); }
void AddPersistentModules(ApplicationModulesManager applicationModulesManager) { WorldCreatorApplication.CheckCompatibility(Application, GetWorldCreatorApplication); if (!string.IsNullOrEmpty(ConnectionString) || Application.ObjectSpaceProviders.OfType <DataServerObjectSpaceProvider>().Any()) { lock (_locker){ var worldCreatorObjectSpaceProvider = WorldCreatorObjectSpaceProvider.Create(Application, false); using (var objectSpace = worldCreatorObjectSpaceProvider.CreateObjectSpace()){ var codeValidator = new CodeValidator(new Compiler(AssemblyPathProvider.Instance.GetPath(Application)), new AssemblyValidator()); var assemblyManager = new AssemblyManager(objectSpace, codeValidator); foreach (var assembly in assemblyManager.LoadAssemblies()) { var moduleType = assembly.GetTypes() .First(type => typeof(ModuleBase).IsAssignableFrom(type)); applicationModulesManager.AddModule(Application, (ModuleBase)moduleType.CreateInstance()); } worldCreatorObjectSpaceProvider.MakeThreadSafe(); } worldCreatorObjectSpaceProvider.SchemaUpdateMode = SchemaUpdateMode.None; } } else { var assemblies = AppDomain.CurrentDomain.GetAssemblies() .Where(assembly => assembly.ManifestModule.ScopeName.EndsWith(Compiler.XpandExtension)); foreach (var assembly1 in assemblies) { applicationModulesManager.AddModule(assembly1.GetTypes() .First(type => typeof(ModuleBase).IsAssignableFrom(type))); } } XpoObjectMerger.MergeTypes(this); }