コード例 #1
0
 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));
 }
コード例 #2
0
ファイル: WorldCreatorModule.cs プロジェクト: noxe/eXpand
 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);
     }
 }
コード例 #3
0
ファイル: TypeSynchronizer.cs プロジェクト: noxe/eXpand
 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);
                 }
             }
         }
     }
 }
コード例 #4
0
ファイル: WorldCreatorModule.cs プロジェクト: vimarx/eXpand
 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);
     }
 }
コード例 #5
0
ファイル: WorldCreatorModuleBase.cs プロジェクト: noxe/eXpand
        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;
            

        }