public virtual UnitOfWork GetUnitOfWork(){ var dataServerObjectSpaceProvider = Application.ObjectSpaceProvider as DataServerObjectSpaceProvider; if (dataServerObjectSpaceProvider != null){ return (UnitOfWork)((XPObjectSpace)dataServerObjectSpaceProvider.CreateObjectSpace()).Session; } var xpoMultiDataStoreProxy = new MultiDataStoreProxy(ConnectionString, GetReflectionDictionary(),AutoCreateOption.DatabaseAndSchema); return new UnitOfWork(new SimpleDataLayer(xpoMultiDataStoreProxy)); }
public override void CustomizeTypesInfo(DevExpress.ExpressApp.DC.ITypesInfo typesInfo) { base.CustomizeTypesInfo(typesInfo); if (_existentTypesMemberCreator == null && RuntimeMode) { _existentTypesMemberCreator = new ExistentTypesMemberCreator(); var reflectionDictionary = WorldCreatorModuleBase.GetReflectionDictionary(this); var xpoMultiDataStoreProxy = new MultiDataStoreProxy(ConnectionString, reflectionDictionary); var simpleDataLayer = new SimpleDataLayer(xpoMultiDataStoreProxy); var session = new Session(simpleDataLayer); _existentTypesMemberCreator.CreateMembers(session,typesInfo); } }
public void SynchronizeTypes(string connectionString) { using (var session = new Session { ConnectionString = connectionString }) { using (var types = new XPCollection<XPObjectType>(session)) { IEnumerable<XPObjectType> xpObjectTypes = types.Where(objectType => ReflectionHelper.FindType(objectType.TypeName) != null).ToList(); var sqlMultiDataStoreProxy = new MultiDataStoreProxy(connectionString); foreach (var connstring in GetConnectionStrings(sqlMultiDataStoreProxy.DataStoreManager, xpObjectTypes, connectionString)) { if (connstring != connectionString) { SynchronizeTypes(connstring, xpObjectTypes); } } } } }
public override void CustomizeTypesInfo(DevExpress.ExpressApp.DC.ITypesInfo typesInfo) { base.CustomizeTypesInfo(typesInfo); if (_existentTypesMemberCreator == null && RuntimeMode) { AddToAdditionalExportedTypes("Xpand.Persistent.BaseImpl.PersistentMetaData"); WCTypesInfo.Instance.Register(GetAdditionalClasses(ModuleManager)); _existentTypesMemberCreator = new ExistentTypesMemberCreator(); var reflectionDictionary = WorldCreatorModuleBase.GetReflectionDictionary(this); var xpoMultiDataStoreProxy = new MultiDataStoreProxy(ConnectionString, reflectionDictionary); var simpleDataLayer = new SimpleDataLayer(xpoMultiDataStoreProxy); var session = new Session(simpleDataLayer); _existentTypesMemberCreator.CreateMembers(session,typesInfo); } }
public override void Setup(ApplicationModulesManager moduleManager) { base.Setup(moduleManager); WCTypesInfo.Instance.Register(GetAdditionalClasses(moduleManager)); if (Application == null || GetPath() == null||!RuntimeMode) return; if (ConnectionString != null) { var xpoMultiDataStoreProxy = new MultiDataStoreProxy(ConnectionString, GetReflectionDictionary()); using (var dataLayer = new SimpleDataLayer(xpoMultiDataStoreProxy)) { using (var unitOfWork = new UnitOfWork(dataLayer)) { RunUpdaters(unitOfWork); AddDynamicModules(moduleManager, unitOfWork); } } } else { var assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(assembly => assembly.ManifestModule.ScopeName.EndsWith(CompileEngine.XpandExtension)); foreach (var assembly1 in assemblies) { moduleManager.AddModule(assembly1.GetTypes().Single(type => typeof(ModuleBase).IsAssignableFrom(type))); } } Application.LoggedOn+=ApplicationOnLoggedOn; }