コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DependencyXPObjectSpace"/> class.
 /// </summary>
 /// <param name="serviceCollection">The service collection.</param>
 /// <param name="typesInfo">The types information.</param>
 /// <param name="xpoTypeInfoSource">The xpo type information source.</param>
 /// <param name="createUnitOfWorkDelegate">The create unit of work delegate.</param>
 public DependencyXPObjectSpace(
     IServiceCollection serviceCollection,
     ITypesInfo typesInfo,
     XpoTypeInfoSource xpoTypeInfoSource,
     CreateUnitOfWorkHandler createUnitOfWorkDelegate
     ) : base(typesInfo, xpoTypeInfoSource, createUnitOfWorkDelegate)
     => this.serviceCollection = serviceCollection;
コード例 #2
0
        bool IsXpoType(Type typeToCreateOn)
        {
            XpoTypeInfoSource xpoTypeInfoSource = XpoTypesInfoHelper.GetXpoTypeInfoSource();

            return(xpoTypeInfoSource.GetOriginalType(typeToCreateOn) != null &&
                   xpoTypeInfoSource.RegisteredEntities.Contains(typeToCreateOn));
        }
コード例 #3
0
ファイル: XafHelper.cs プロジェクト: genesissupsup/XpandBlog
        public XafHelper(IUnityContainer unityContainer, string connectionString = null)
        {
            if (connectionString == null)
            {
                connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            }

            foreach (var type in Types)
            {
                XafTypesInfo.Instance.RegisterEntity(type);
            }

            var typesInfoSource = new XpoTypeInfoSource(XafTypesInfo.Instance as TypesInfo);

            foreach (var type in Types)
            {
                typesInfoSource.RegisterEntity(type);
            }

            _ObjectSpaceProvider = new UnityXPObjectSpaceProvider(new ConnectionStringDataStoreProvider(connectionString), XafTypesInfo.Instance, typesInfoSource, unityContainer, true);

            using (var objectSpace = _ObjectSpaceProvider.CreateUpdatingObjectSpace(false))
            {
                var xpObjectSpace = objectSpace as XPObjectSpace;
                if (xpObjectSpace != null)
                    xpObjectSpace.Session.CreateObjectTypeRecords();
            }
        }
        void application_CreateCustomObjectSpaceProvider(object sender, CreateCustomObjectSpaceProviderEventArgs e)
        {
            XafApplication application = (XafApplication)sender;

            if (typeInfoSource1 == null)
            {
                lock (lockObj) {
                    if (typeInfoSource1 == null)
                    {
                        typeInfoSource1 = new XpoTypeInfoSource((TypesInfo)application.TypesInfo,
                                                                typeof(PersistentClass1), typeof(ModuleInfo1)
                                                                );
                    }
                }
            }
            //XPObjectSpaceProvider objectSpaceProvider1 = new XPObjectSpaceProvider(
            IObjectSpaceProvider objectSpaceProvider1 = new SecuredObjectSpaceProvider(
                (SecurityStrategyComplex)application.Security,
                new ConnectionStringDataStoreProvider(ConfigurationManager.ConnectionStrings["ConnectionStringDatabase1"].ConnectionString),
                application.TypesInfo,
                typeInfoSource1, true
                );

            objectSpaceProvider1.CheckCompatibilityType = CheckCompatibilityType.ModuleInfo;
            e.ObjectSpaceProviders.Add(objectSpaceProvider1);
        }
コード例 #5
0
ファイル: XafHelper.cs プロジェクト: ewin66/XpandBlog
        public XafHelper(IUnityContainer unityContainer, string connectionString = null)
        {
            if (connectionString == null)
            {
                connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            }

            foreach (var type in Types)
            {
                XafTypesInfo.Instance.RegisterEntity(type);
            }

            var typesInfoSource = new XpoTypeInfoSource(XafTypesInfo.Instance as TypesInfo);

            foreach (var type in Types)
            {
                typesInfoSource.RegisterEntity(type);
            }

            _ObjectSpaceProvider = new UnityXPObjectSpaceProvider(new ConnectionStringDataStoreProvider(connectionString), XafTypesInfo.Instance, typesInfoSource, unityContainer, true);

            using (var objectSpace = _ObjectSpaceProvider.CreateUpdatingObjectSpace(false))
            {
                var xpObjectSpace = objectSpace as XPObjectSpace;
                if (xpObjectSpace != null)
                {
                    xpObjectSpace.Session.CreateObjectTypeRecords();
                }
            }
        }
コード例 #6
0
 void AssignSecurityEntities()
 {
     if (Application != null)
     {
         var roleTypeProvider = Application.Security as IRoleTypeProvider;
         if (roleTypeProvider != null)
         {
             RoleType =
                 XafTypesInfo.Instance.PersistentTypes.Single(info => info.Type == roleTypeProvider.RoleType)
                 .Type;
             if (RoleType.IsInterface)
             {
                 RoleType = XpoTypeInfoSource.GetGeneratedEntityType(RoleType);
             }
         }
         if (Application.Security != null)
         {
             UserType = Application.Security.UserType;
             if (UserType != null && UserType.IsInterface)
             {
                 UserType = XpoTypeInfoSource.GetGeneratedEntityType(UserType);
             }
         }
     }
 }
コード例 #7
0
ファイル: TypesInfoBuilder.cs プロジェクト: aries544/eXpand
 TypesInfo GetTypesInfo() {
     var typesInfo = new TypesInfo();
     typesInfo.AddEntityStore(new NonPersistentEntityStore(typesInfo));
     var xpoSource = new XpoTypeInfoSource(typesInfo);
     typesInfo.Source = xpoSource;
     typesInfo.AddEntityStore(xpoSource);
     return typesInfo;
 }
コード例 #8
0
        public static void AssignAsPersistentEntityStore(this XpoTypeInfoSource xpoTypeInfoSource)
        {
            var entityStores = (List <IEntityStore>)XafTypesInfo.Instance.GetFieldValue("entityStores");

            entityStores.RemoveAll(store => store is XpoTypeInfoSource);
            XafTypesInfo.Instance.SetFieldValue("dcEntityStore", null);
            ((TypesInfo)XafTypesInfo.Instance).AddEntityStore(xpoTypeInfoSource);
        }
コード例 #9
0
ファイル: TypesInfoBuilder.cs プロジェクト: xwagner2/eXpand
        TypesInfo GetTypesInfo()
        {
            var typesInfo = new TypesInfo();

            typesInfo.AddEntityStore(new NonPersistentEntityStore(typesInfo));
            var xpoSource = new XpoTypeInfoSource(typesInfo);

            typesInfo.Source = xpoSource;
            typesInfo.AddEntityStore(xpoSource);
            return(typesInfo);
        }
コード例 #10
0
        private static XPObjectSpaceProvider CreateObjectSpaceProvider(string CompanyId) //TODO use companyID
        {
            XpoTypesInfoHelper.ForceInitialize();
            ITypesInfo        typesInfo         = XpoTypesInfoHelper.GetTypesInfo();
            XpoTypeInfoSource xpoTypeInfoSource = XpoTypesInfoHelper.GetXpoTypeInfoSource();

            RegisterBOTypes(typesInfo);
            ConnectionStringDataStoreProvider dataStoreProvider = new ConnectionStringDataStoreProvider(MSSqlConnectionProvider.GetConnectionString("weedware101.database.windows.net,1433", "demodbjose", "*.mk3247", "demodbjose"));

            return(new XPObjectSpaceProvider(dataStoreProvider, typesInfo, xpoTypeInfoSource));
        }
コード例 #11
0
        public static XPObjectSpaceProvider CreateObjectSpaceProvider(string connectionString)
        {
            XpoTypesInfoHelper.ForceInitialize();
            ITypesInfo        typesInfo         = XpoTypesInfoHelper.GetTypesInfo();
            XpoTypeInfoSource xpoTypeInfoSource = XpoTypesInfoHelper.GetXpoTypeInfoSource();

            RegisterBOTypes(typesInfo);
            ConnectionStringDataStoreProvider dataStoreProvider = new ConnectionStringDataStoreProvider(connectionString);

            return(new XPObjectSpaceProvider(dataStoreProvider, typesInfo, xpoTypeInfoSource));
        }
コード例 #12
0
        TypesInfo GetTypesInfo()
        {
            var typesInfo = new TypesInfo();

            typesInfo.AddEntityStore(new NonPersistentEntityStore(typesInfo));
            var xpoSource = new XpoTypeInfoSource(typesInfo);

            typesInfo.AddEntityStore(xpoSource);
            XpandModuleBase.Dictiorary = xpoSource.XPDictionary;
            return(typesInfo);
        }
コード例 #13
0
        void application_CreateCustomObjectSpaceProvider(object sender, CreateCustomObjectSpaceProviderEventArgs e)
        {
            XafApplication application = (XafApplication)sender;

            if (objectSpaceProvider2 == null)
            {
                XpoTypeInfoSource typeInfoSource2 = new XpoTypeInfoSource((TypesInfo)application.TypesInfo,
                                                                          typeof(PersistentClass2), typeof(ModuleInfo2)
                                                                          );
                objectSpaceProvider2 = new XPObjectSpaceProvider(
                    new ConnectionStringDataStoreProvider(ConfigurationManager.ConnectionStrings["ConnectionStringDatabase2"].ConnectionString),
                    application.TypesInfo,
                    typeInfoSource2, true
                    );
            }
            e.ObjectSpaceProviders.Add(objectSpaceProvider2);
        }
コード例 #14
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo)
 {
     base.CustomizeTypesInfo(typesInfo);
     if (FilterProviderManager.IsRegistered && FilterProviderManager.Providers != null)
     {
         CreateMembers(typesInfo);
         foreach (var persistentType in typesInfo.PersistentTypes.Where(info => info.IsPersistent && !info.IsInterface))
         {
             var xpClassInfo = XpoTypeInfoSource.GetEntityClassInfo(persistentType.Type);
             if (xpClassInfo != null && (xpClassInfo.TableName != null && xpClassInfo.ClassType != null))
             {
                 if (!IsMappedToParent(xpClassInfo) && !TablesDictionary.ContainsKey(xpClassInfo.TableName))
                 {
                     TablesDictionary.Add(xpClassInfo.TableName, xpClassInfo.ClassType);
                 }
             }
         }
     }
 }
        void application_CreateCustomObjectSpaceProvider(object sender, CreateCustomObjectSpaceProviderEventArgs e)
        {
            XafApplication application = (XafApplication)sender;

            if (typeInfoSource1 == null)
            {
                lock (lockObj) {
                    if (typeInfoSource1 == null)
                    {
                        typeInfoSource1 = new XpoTypeInfoSource((TypesInfo)application.TypesInfo,
                                                                typeof(PersistentClass1), typeof(ModuleInfo1)
                                                                );
                    }
                }
            }
            XPObjectSpaceProvider objectSpaceProvider1 = new XPObjectSpaceProvider(
                new ConnectionStringDataStoreProvider(ConfigurationManager.ConnectionStrings["ConnectionStringDatabase1"].ConnectionString),
                application.TypesInfo,
                typeInfoSource1, true
                );

            e.ObjectSpaceProviders.Add(objectSpaceProvider1);
        }
コード例 #16
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);
        }
コード例 #17
0
        void application_CreateCustomObjectSpaceProvider(object sender, CreateCustomObjectSpaceProviderEventArgs e)
        {
            XafApplication application = (XafApplication)sender;

            if (typeInfoSource == null)
            {
                lock (lockObj) {
                    if (typeInfoSource == null)
                    {
                        typeInfoSource = new XpoTypeInfoSource((TypesInfo)application.TypesInfo,
                                                               typeof(DevExpress.Persistent.BaseImpl.ModelDifference),
                                                               typeof(DevExpress.Persistent.BaseImpl.ModelDifferenceAspect),
                                                               typeof(DevExpress.Persistent.BaseImpl.PermissionPolicy.PermissionPolicyUser),
                                                               typeof(DevExpress.Persistent.BaseImpl.PermissionPolicy.PermissionPolicyRole),
                                                               typeof(DevExpress.Persistent.BaseImpl.PermissionPolicy.PermissionPolicyTypePermissionObject),
                                                               typeof(DevExpress.Persistent.BaseImpl.PermissionPolicy.PermissionPolicyObjectPermissionsObject),
                                                               typeof(DevExpress.Persistent.BaseImpl.PermissionPolicy.PermissionPolicyMemberPermissionsObject),
                                                               typeof(DevExpress.Persistent.BaseImpl.PermissionPolicy.PermissionPolicyNavigationPermissionObject),
                                                               typeof(DevExpress.Persistent.BaseImpl.PermissionPolicy.PermissionPolicyActionPermissionObject),
                                                               typeof(ApplicationUser)
                                                               );
                    }
                }
            }
            //IObjectSpaceProvider objectSpaceProvider = new XPObjectSpaceProvider(
            IObjectSpaceProvider objectSpaceProvider = new SecuredObjectSpaceProvider(
                (SecurityStrategyComplex)application.Security,
                new ConnectionStringDataStoreProvider(ConfigurationManager.ConnectionStrings["ConnectionStringDatabaseCommon"].ConnectionString),
                application.TypesInfo,
                typeInfoSource, true
                );

            objectSpaceProvider.CheckCompatibilityType = CheckCompatibilityType.DatabaseSchema;
            e.ObjectSpaceProviders.Add(objectSpaceProvider);
            e.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(application.TypesInfo, null));
        }
コード例 #18
0
 public ExtObjectSpaceProvider(IXpoDataStoreProvider dataStoreProvider, ITypesInfo typesInfo, XpoTypeInfoSource xpoTypeInfoSource, bool threadSafe)
     : base(dataStoreProvider, typesInfo, xpoTypeInfoSource, threadSafe)
 {
 }
コード例 #19
0
 public UnityXPObjectSpaceProvider(IXpoDataStoreProvider dataStoreProvider, ITypesInfo typesInfo, XpoTypeInfoSource xpoTypeInfoSource, IUnityContainer unityContainer)
     : base(dataStoreProvider, typesInfo, xpoTypeInfoSource)
 {
     SetUnityContainer(unityContainer);
 }
コード例 #20
0
ファイル: XpandObjectSpace.cs プロジェクト: dimajanzen/eXpand
 public XpandObjectSpace(ITypesInfo typesInfo, XpoTypeInfoSource xpoTypeInfoSource, CreateUnitOfWorkHandler createUnitOfWorkDelegate)
     : base(typesInfo, xpoTypeInfoSource, createUnitOfWorkDelegate.Invoke) {
 }
コード例 #21
0
 /// <summary>Конструктор</summary>
 /// <param name="selectDataSecurityProviders">Поставщики безопасности операций с данными</param>
 /// <param name="dataStoreProvider">Поставщик базы данных</param>
 /// <param name="typesInfo"></param>
 /// <param name="xpoTypeInfoSource"></param>
 /// <param name="threadSafe">Флаг потоковой безоопасности</param>
 public ComplexObjectSpaceProvider(ISelectDataSecurityProvider[] selectDataSecurityProviders, IXpoDataStoreProvider dataStoreProvider, ITypesInfo typesInfo, XpoTypeInfoSource xpoTypeInfoSource, Boolean threadSafe)
     : base(dataStoreProvider, typesInfo, xpoTypeInfoSource, threadSafe)
 {
     Initialize(selectDataSecurityProviders);
 }
コード例 #22
0
 /// <summary>Конструктор</summary>
 /// <param name="selectDataSecurityProviders">Поставщики безопасности операций с данными</param>
 /// <param name="dataStoreProvider">Поставщик базы данных</param>
 /// <param name="typesInfo"></param>
 /// <param name="xpoTypeInfoSource"></param>
 public ComplexObjectSpaceProvider(ISelectDataSecurityProvider[] selectDataSecurityProviders, IXpoDataStoreProvider dataStoreProvider, ITypesInfo typesInfo, XpoTypeInfoSource xpoTypeInfoSource)
     : this(selectDataSecurityProviders, dataStoreProvider, typesInfo, xpoTypeInfoSource, true)
 {
 }
コード例 #23
0
 public FastObjectSpaceProvider(IXpoDataStoreProvider dataStoreProvider, ITypesInfo typesInfo, XpoTypeInfoSource xpoTypeInfoSource) : base(dataStoreProvider, typesInfo, xpoTypeInfoSource)
 {
 }
コード例 #24
0
 public FastObjectSpaceProvider(IXpoDataStoreProvider dataStoreProvider, ITypesInfo typesInfo, XpoTypeInfoSource xpoTypeInfoSource, bool threadSafe, bool useSeparateDataLayers = false) : base(dataStoreProvider, typesInfo, xpoTypeInfoSource, threadSafe, useSeparateDataLayers)
 {
 }
コード例 #25
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;
        }
コード例 #26
0
 public XpandObjectSpace(ITypesInfo typesInfo, XpoTypeInfoSource xpoTypeInfoSource, CreateUnitOfWorkHandler createUnitOfWorkDelegate)
     : base(typesInfo, xpoTypeInfoSource, createUnitOfWorkDelegate.Invoke)
 {
 }
コード例 #27
0
 public UnityXPObjectSpaceProvider(IXpoDataStoreProvider dataStoreProvider, ITypesInfo typesInfo, XpoTypeInfoSource xpoTypeInfoSource, IUnityContainer unityContainer)
     : base(dataStoreProvider, typesInfo, xpoTypeInfoSource)
 {
     SetUnityContainer(unityContainer);
 }