Example #1
0
 public override void Setup(ApplicationModulesManager moduleManager)
 {
     base.Setup(moduleManager);
     AddToAdditionalExportedTypes("Xpand.Persistent.BaseImpl.PivotChart");
     try {
         if (RuntimeMode)
         {
             var assembly = Assembly.Load("DevExpress.Persistent.BaseImpl" + XafAssemblyInfo.VersionSuffix);
             TypesInfo.LoadTypes(assembly);
             var typeInfo = TypesInfo.FindTypeInfo("DevExpress.Persistent.BaseImpl.Analysis").Type;
             AdditionalExportedTypes.Add(typeInfo);
         }
     } catch (FileNotFoundException) {
         throw new TypeLoadException("Please make sure DevExpress.Persistent.BaseImpl is referenced from your application project and has its Copy Local==true");
     }
 }
Example #2
0
        public static IEnumerable <Type> CollectExportedTypesFromAssembly(Assembly assembly)
        {
            var typesList = new ExportedTypeCollection();

            try {
                TypesInfo.LoadTypes(assembly);
                if (assembly == typeof(XPObject).Assembly)
                {
                    typesList.AddRange(XpoTypeInfoSource.XpoBaseClasses);
                }
                else
                {
                    typesList.AddRange(assembly.GetTypes());
                }
            } catch (Exception e) {
                throw new InvalidOperationException(
                          String.Format("Exception occurs while ensure classes from assembly {0}\r\n{1}", assembly.FullName, e.Message), e);
            }
            return(typesList);
        }
Example #3
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);
        }
Example #4
0
 bool ValidateBOModel(IPersistentAssemblyInfo persistentAssemblyInfo, Type compileCore) {
     if (persistentAssemblyInfo.ValidateModelOnCompile) {
         try {
             var typesInfo = new TypesInfo();
             typesInfo.AddEntityStore(new NonPersistentEntityStore(typesInfo));
             typesInfo.AddEntityStore(new XpoTypeInfoSource(typesInfo));
             typesInfo.LoadTypes(compileCore.Assembly);
             var applicationModulesManager = new ApplicationModulesManager();
             applicationModulesManager.AddModule(compileCore);
             applicationModulesManager.Load(typesInfo, true);
         } catch (Exception exception) {
             persistentAssemblyInfo.CompileErrors = exception.ToString();
             return false;
         }
     }
     return true;
 }
Example #5
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;
        }