/// <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;
bool IsXpoType(Type typeToCreateOn) { XpoTypeInfoSource xpoTypeInfoSource = XpoTypesInfoHelper.GetXpoTypeInfoSource(); return(xpoTypeInfoSource.GetOriginalType(typeToCreateOn) != null && xpoTypeInfoSource.RegisteredEntities.Contains(typeToCreateOn)); }
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); }
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 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); } } } }
TypesInfo GetTypesInfo() { var typesInfo = new TypesInfo(); typesInfo.AddEntityStore(new NonPersistentEntityStore(typesInfo)); var xpoSource = new XpoTypeInfoSource(typesInfo); typesInfo.Source = xpoSource; typesInfo.AddEntityStore(xpoSource); return typesInfo; }
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); }
TypesInfo GetTypesInfo() { var typesInfo = new TypesInfo(); typesInfo.AddEntityStore(new NonPersistentEntityStore(typesInfo)); var xpoSource = new XpoTypeInfoSource(typesInfo); typesInfo.Source = xpoSource; typesInfo.AddEntityStore(xpoSource); return(typesInfo); }
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)); }
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)); }
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); }
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); }
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); }
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); }
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)); }
public ExtObjectSpaceProvider(IXpoDataStoreProvider dataStoreProvider, ITypesInfo typesInfo, XpoTypeInfoSource xpoTypeInfoSource, bool threadSafe) : base(dataStoreProvider, typesInfo, xpoTypeInfoSource, threadSafe) { }
public UnityXPObjectSpaceProvider(IXpoDataStoreProvider dataStoreProvider, ITypesInfo typesInfo, XpoTypeInfoSource xpoTypeInfoSource, IUnityContainer unityContainer) : base(dataStoreProvider, typesInfo, xpoTypeInfoSource) { SetUnityContainer(unityContainer); }
public XpandObjectSpace(ITypesInfo typesInfo, XpoTypeInfoSource xpoTypeInfoSource, CreateUnitOfWorkHandler createUnitOfWorkDelegate) : base(typesInfo, xpoTypeInfoSource, createUnitOfWorkDelegate.Invoke) { }
/// <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); }
/// <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) { }
public FastObjectSpaceProvider(IXpoDataStoreProvider dataStoreProvider, ITypesInfo typesInfo, XpoTypeInfoSource xpoTypeInfoSource) : base(dataStoreProvider, typesInfo, xpoTypeInfoSource) { }
public FastObjectSpaceProvider(IXpoDataStoreProvider dataStoreProvider, ITypesInfo typesInfo, XpoTypeInfoSource xpoTypeInfoSource, bool threadSafe, bool useSeparateDataLayers = false) : base(dataStoreProvider, typesInfo, xpoTypeInfoSource, threadSafe, useSeparateDataLayers) { }
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; }