コード例 #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");
     }
 }
コード例 #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);
        }
コード例 #3
0
ファイル: Updater.cs プロジェクト: xwagner2/eXpand
        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);
        }
コード例 #4
0
ファイル: CompileEngine.cs プロジェクト: paulute/eXpand
 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;
 }
コード例 #5
0
ファイル: Updater.cs プロジェクト: aries544/eXpand
        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;
        }