Exemplo n.º 1
0
        public bool Run(RuntimeSetupInfo setupInfo)
        {
            var typesInfo = new TypesInfo();

            typesInfo.AddEntityStore(new NonPersistentEntityStore(typesInfo));
            var reflectionDictionary = new ReflectionDictionary(); reflectionDictionary.CollectClassInfos(typeof(ModuleArtifact).Assembly);
            var xpoTypeInfoSource    = new XpoTypeInfoSource(typesInfo, reflectionDictionary);

            typesInfo.AddEntityStore(xpoTypeInfoSource);
            typesInfo.LoadTypes(typeof(ModuleArtifact).Assembly);
            var exportedTypesFromAssembly = ModuleHelper.CollectExportedTypesFromAssembly(typeof(ModuleArtifact).Assembly, ExportedTypeHelpers.IsExportedType);

            foreach (var type in exportedTypesFromAssembly)
            {
                xpoTypeInfoSource.RegisterEntity(type);
            }

            var objectSpace = new XPObjectSpace(typesInfo, xpoTypeInfoSource, () => new UnitOfWork(reflectionDictionary)
            {
                ConnectionString = setupInfo.ConnectionString
            });

            if (!objectSpace.Contains <ModuleChild>())
            {
                var moduleTypes  = GetModuleTypes(setupInfo);
                var childModules = objectSpace.GetModuleChilds(moduleTypes);
                foreach (var childModule in childModules)
                {
                    childModule.Value.CreateArtifacts(childModule.Key);
                    childModule.Value.CreateExtenderInterfaces(childModule.Key);
                }
                UpdateMapViewModule(childModules, objectSpace);
            }
            CreateObjects(objectSpace, setupInfo);
            objectSpace.CommitChanges();
            return(true);
        }
Exemplo n.º 2
0
        public bool Run(RuntimeSetupInfo setupInfo) {
            var typesInfo = new TypesInfo();
            typesInfo.AddEntityStore(new NonPersistentEntityStore(typesInfo));
            var reflectionDictionary = new ReflectionDictionary();reflectionDictionary.CollectClassInfos(typeof(ModuleArtifact).Assembly);
            var xpoTypeInfoSource = new XpoTypeInfoSource(typesInfo,reflectionDictionary);
            typesInfo.AddEntityStore(xpoTypeInfoSource);
            typesInfo.LoadTypes(typeof(ModuleArtifact).Assembly);
            var exportedTypesFromAssembly = ModuleHelper.CollectExportedTypesFromAssembly(typeof(ModuleArtifact).Assembly,ExportedTypeHelpers.IsExportedType);
            foreach (var type in exportedTypesFromAssembly){
                xpoTypeInfoSource.RegisterEntity(type);
            }

            var objectSpace = new XPObjectSpace(typesInfo, xpoTypeInfoSource, () => new UnitOfWork(reflectionDictionary){ ConnectionString = setupInfo.ConnectionString });
            if (!objectSpace.Contains<ModuleChild>()){
                var moduleTypes = GetModuleTypes(setupInfo);
                var childModules = objectSpace.GetModuleChilds(moduleTypes);
                foreach (var childModule in childModules){
                    childModule.Value.CreateArtifacts(childModule.Key);
                    childModule.Value.CreateExtenderInterfaces(childModule.Key);
                }
                UpdateMapViewModule(childModules, objectSpace);
            }
            CreateObjects(objectSpace, setupInfo);
            objectSpace.CommitChanges();
            return true;
        }