コード例 #1
0
 public CachedDataStoreProvider(string connectionString, IDbConnection connection, bool enablePoolingInConnectionString)
 {
     if (xpoDataStoreProvider == null)
     {
         xpoDataStoreProvider = XPObjectSpaceProvider.GetDataStoreProvider(connectionString, connection, enablePoolingInConnectionString);
     }
 }
コード例 #2
0
        private IXpoDataStoreProvider GetDataStoreProvider(string connectionString, System.Data.IDbConnection connection)
        {
            System.Web.HttpApplicationState application       = (System.Web.HttpContext.Current != null) ? System.Web.HttpContext.Current.Application : null;
            IXpoDataStoreProvider           dataStoreProvider = null;

            if (application != null && application["DataStoreProvider"] != null)
            {
                dataStoreProvider = application["DataStoreProvider"] as IXpoDataStoreProvider;
            }
            else
            {
                dataStoreProvider = XPObjectSpaceProvider.GetDataStoreProvider(connectionString, connection, true);
                if (application != null)
                {
                    application["DataStoreProvider"] = dataStoreProvider;
                }
            }
            return(dataStoreProvider);
            //         IXpoDataStoreProvider dataStoreProvider = null;
            //         if(!String.IsNullOrEmpty(connectionString)) {
            //             dataStoreProvider = new ConnectionStringDataStoreProvider(connectionString);
            //         }
            //         else if(connection != null) {
            //             dataStoreProvider = new ConnectionDataStoreProvider(connection);
            //         }
            //return dataStoreProvider;
        }
コード例 #3
0
 public static IXpoDataStoreProvider GetDataStoreProvider(string connectionString, IDbConnection connection, bool enablePoolingInConnectionString = true)
 {
     if (UseSQLAlternativeInfoSingleton.Instance.UseAlternative)
     {
         connectionString = InMemoryDataStoreProvider.ConnectionString;
     }
     if (connection != null)
     {
         connectionString = null;
     }
     else
     {
         if ((connectionString != InMemoryDataStoreProvider.ConnectionString) && !string.IsNullOrEmpty(connectionString) && !DemoDbEngineDetectorHelper.IsSqlServerAccessible(connectionString))
         {
             string patchedConnectionString = DemoDbEngineDetectorHelper.PatchSQLConnectionString(connectionString);
             if ((patchedConnectionString == DemoDbEngineDetectorHelper.AlternativeConnectionString) || !DemoDbEngineDetectorHelper.IsSqlServerAccessible(patchedConnectionString))
             {
                 UseSQLAlternativeInfoSingleton.Instance.FillFields(DemoDbEngineDetectorHelper.GetIssueMessage(patchedConnectionString), DemoXPODatabaseHelper.AlternativeName, DemoXPODatabaseHelper.InMemoryDatabaseUsageMessage);
                 patchedConnectionString = InMemoryDataStoreProvider.ConnectionString;
             }
             connectionString = patchedConnectionString;
         }
     }
     return(XPObjectSpaceProvider.GetDataStoreProvider(connectionString, connection, enablePoolingInConnectionString));
 }
コード例 #4
0
 public IXpoDataStoreProvider GetDataStoreProvider(string connectionString, IDbConnection connection, bool enablePoolingInConnectionString)
 {
     if (dataStoreProvider == null)
     {
         dataStoreProvider = XPObjectSpaceProvider.GetDataStoreProvider(connectionString, connection, enablePoolingInConnectionString);
     }
     return(dataStoreProvider);
 }
        protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args)
        {
            IXpoDataStoreProvider dataStoreProvider = XPObjectSpaceProvider.GetDataStoreProvider(args.ConnectionString, args.Connection, true);

            args.ObjectSpaceProvider = new XPObjectSpaceProvider(dataStoreProvider, true);// TestListViewController requires a thread-safe DAL
            args.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(TypesInfo, null));
            GenerateUserFriendlyId.Module.SequenceGenerator.Initialize(dataStoreProvider);
        }
 public IXpoDataStoreProvider GetDataStoreProvider()
 {
     if (dataStoreProvider == null)
     {
         dataStoreProvider = XPObjectSpaceProvider.GetDataStoreProvider(connectionString, null, true);
     }
     return(dataStoreProvider);
 }
コード例 #7
0
        protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args)
        {
            args.ObjectSpaceProviders.Add(new XPObjectSpaceProvider(XPObjectSpaceProvider.GetDataStoreProvider(args.ConnectionString, args.Connection, true), false));
            args.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(TypesInfo, null));
            GlobalVar.LabelPrinterName = Properties.Settings.Default.LabelPrinterName;

            GlobalVar.DCPrinterName = Properties.Settings.Default.DCPrinterName;
        }
 public static IXpoDataStoreProvider GetDataStoreProvider(IDbConnection connection, bool enablePoolingInConnectionString)
 {
     if (dataStoreProvider == null)
     {
         string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
         dataStoreProvider = XPObjectSpaceProvider.GetDataStoreProvider(connectionString, connection, enablePoolingInConnectionString);
     }
     return(dataStoreProvider);
 }
コード例 #9
0
        private IXpoDataStoreProvider GetDataStoreProvider(string connectionString, System.Data.IDbConnection connection)
        {
            var accessor = ServiceProvider.GetRequiredService <XpoDataStoreProviderAccessor>();

            lock (accessor) {
                accessor.DataStoreProvider ??= XPObjectSpaceProvider.GetDataStoreProvider(connectionString, connection, true);
            }
            return(accessor.DataStoreProvider);
        }
コード例 #10
0
 protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args)
 {
     _ = args ?? throw new ArgumentNullException(nameof(args));
     args.ObjectSpaceProviders.Add(new XPObjectSpaceProvider(
                                       XPObjectSpaceProvider.GetDataStoreProvider(args.ConnectionString, args.Connection, true),
                                       true
                                       ));
     args.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(TypesInfo, null));
 }
        public IXpoDataStoreProvider GetDataStoreProvider(string connectionString, IDbConnection connection)
        {
            return(xpoDataStoreProviderDictionary.GetOrAdd(connectionString, CreateDataStoreProvider));

            IXpoDataStoreProvider CreateDataStoreProvider(string connectionString)
            {
                //TODO Minakov the enablePoolingInConnectionString parameter should be true. Change after IObjectSpace.DataBase fix
                return(XPObjectSpaceProvider.GetDataStoreProvider(connectionString, connection, false));
            }
        }
コード例 #12
0
        private IXpoDataStoreProvider GetDataStoreProvider(string connectionString, System.Data.IDbConnection connection)
        {
            useMemoryStore = false;
            XpoDataStoreProviderAccessor accessor = ServiceProvider.GetRequiredService <XpoDataStoreProviderAccessor>();

            lock (accessor) {
                if (accessor.DataStoreProvider == null)
                {
                    accessor.DataStoreProvider = XPObjectSpaceProvider.GetDataStoreProvider(connectionString, connection, !useMemoryStore);
                }
            }
            return(accessor.DataStoreProvider);
        }
コード例 #13
0
        protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args)
        {
            //args.ObjectSpaceProviders.Add(new SecuredObjectSpaceProvider((SecurityStrategyComplex)Security, XPObjectSpaceProvider.GetDataStoreProvider(args.ConnectionString, args.Connection, true), false));
            //args.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(TypesInfo, null));
            XpoDefault.TrackPropertiesModifications = true;

            IXpoDataStoreProvider dataStoreProvider = XPObjectSpaceProvider.GetDataStoreProvider(args.ConnectionString, args.Connection, true);

            args.ObjectSpaceProvider = new XPObjectSpaceProvider(dataStoreProvider, true);// TestListViewController requires a thread-safe DAL
            args.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(TypesInfo, null));

            SequenceGenerator.Initialize(dataStoreProvider);
        }
コード例 #14
0
 private IXpoDataStoreProvider GetDataStoreProvider(string connectionString, System.Data.IDbConnection connection) {
     System.Web.HttpApplicationState application = (System.Web.HttpContext.Current != null) ? System.Web.HttpContext.Current.Application : null;
     IXpoDataStoreProvider dataStoreProvider = null;
     if(application != null && application["DataStoreProvider"] != null) {
         dataStoreProvider = application["DataStoreProvider"] as IXpoDataStoreProvider;
     }
     else {
         dataStoreProvider = XPObjectSpaceProvider.GetDataStoreProvider(connectionString, connection, true);
         if(application != null) {
             application["DataStoreProvider"] = dataStoreProvider;
         }
     }
     return dataStoreProvider;
 }
        private IXpoDataStoreProvider GetDataStoreProvider(string connectionString, System.Data.IDbConnection connection)
        {
            IXpoDataStoreProvider xpoDataStoreProvider;

            lock (xpoDataStoreProviderDictionary)
            {
                if (!xpoDataStoreProviderDictionary.TryGetValue(connectionString, out xpoDataStoreProvider))
                {
                    //TODO Minakov the enablePoolingInConnectionString parameter should be true. Change after IObjectSpace.DataBase fix
                    xpoDataStoreProvider = XPObjectSpaceProvider.GetDataStoreProvider(connectionString, connection, false);
                    xpoDataStoreProviderDictionary[connectionString] = xpoDataStoreProvider;
                }
            }
            return(xpoDataStoreProvider);
        }
コード例 #16
0
        protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args)
        {
            IObjectSpaceProvider provider;

            if (dxTestSolution.Module.dxTestSolutionModule.UseInMemoryStore)
            {
                provider = new XPObjectSpaceProvider(InMemoryDataStoreProvider.ConnectionString, null, false);
            }
            else
            {
                provider = new XPObjectSpaceProvider(XPObjectSpaceProvider.GetDataStoreProvider(args.ConnectionString, args.Connection, true), false);
            }
            //secur#9
            args.ObjectSpaceProviders.Add(provider);
            args.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(TypesInfo, null));
        }
コード例 #17
0
        private IXpoDataStoreProvider GetDataStoreProvider(string connectionString, IDbConnection connection)
        {
            var application = HttpContext.Current != null ? HttpContext.Current.Application : null;
            IXpoDataStoreProvider dataStoreProvider;

            if (application?["DataStoreProvider"] != null)
            {
                dataStoreProvider = application["DataStoreProvider"] as IXpoDataStoreProvider;
            }
            else
            {
                dataStoreProvider = XPObjectSpaceProvider.GetDataStoreProvider(connectionString, connection, true);
                if (application != null)
                {
                    application["DataStoreProvider"] = dataStoreProvider;
                }
            }

            return(dataStoreProvider);
        }
コード例 #18
0
        public static IXpoDataStoreProvider GetDataStoreProvider(string connectionString, IDbConnection connection, bool enablePoolingInConnectionString = true)
        {
            IXpoDataStoreProvider xpoDataStoreProvider = null;

            if (UseSQLAlternativeInfoSingleton.Instance.UseAlternative || (connectionString == InMemoryDataStoreProvider.ConnectionString))
            {
                xpoDataStoreProvider = DemoXPODatabaseHelper.GetInMemoryDataStoreProvider(enablePoolingInConnectionString);
            }
            else
            {
                if ((connection != null) || DemoDbEngineDetectorHelper.IsSqlServerAccessible(connectionString))
                {
                    xpoDataStoreProvider = XPObjectSpaceProvider.GetDataStoreProvider(connectionString, connection, enablePoolingInConnectionString);
                }
                else
                {
                    UseSQLAlternativeInfoSingleton.Instance.FillFields(DemoDbEngineDetectorHelper.DBServerIsNotAccessibleMessage, DemoXPODatabaseHelper.AlternativeName, DemoXPODatabaseHelper.InMemoryDatabaseUsageMessage);
                    xpoDataStoreProvider = DemoXPODatabaseHelper.GetInMemoryDataStoreProvider(enablePoolingInConnectionString);
                }
            }
            return(xpoDataStoreProvider);
        }
コード例 #19
0
 public CustomIXpoDataStoreProvider(string connectionString, IDbConnection connection, bool enablePoolingInConnectionString)
 {
     innerDataStoreProvider = XPObjectSpaceProvider.GetDataStoreProvider(connectionString, connection, enablePoolingInConnectionString);
 }
コード例 #20
0
 protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args)
 {
     args.ObjectSpaceProviders.Add(new XPObjectSpaceProvider(XPObjectSpaceProvider.GetDataStoreProvider(InMemoryDataStoreProvider.ConnectionString, args.Connection, true), false));
     args.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(TypesInfo, null));
 }
コード例 #21
0
 protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args)
 {
     args.ObjectSpaceProviders.Add(new SecuredObjectSpaceProvider((SecurityStrategyComplex)Security, XPObjectSpaceProvider.GetDataStoreProvider(args.ConnectionString, args.Connection, true), false));
     args.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(TypesInfo, null));
     #region allow store proc
     ((SecuredObjectSpaceProvider)args.ObjectSpaceProvider).AllowICommandChannelDoWithSecurityContext = true;
     #endregion
 }
コード例 #22
0
 private IXpoDataStoreProvider GetDataStoreProvider(string connectionString, System.Data.IDbConnection connection)
 {
     //TODO SPA
     return(XPObjectSpaceProvider.GetDataStoreProvider(connectionString, connection, true));
 }
コード例 #23
0
 protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args)
 {
     args.ObjectSpaceProviders.Add(new XPObjectSpaceProvider(XPObjectSpaceProvider.GetDataStoreProvider(ConfigurationManager.ConnectionStrings["ConnectionStringXpo"].ConnectionString, null, true), false));
     args.ObjectSpaceProviders.Add(new EFObjectSpaceProvider(typeof(SimpleProjectManagerDbContext), ConfigurationManager.ConnectionStrings["ConnectionStringEF"].ConnectionString));
     args.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(TypesInfo, null));
 }
コード例 #24
0
 public static IXpoDataStoreProvider GetInMemoryDataStoreProvider(bool enablePoolingInConnectionString)
 {
     return(XPObjectSpaceProvider.GetDataStoreProvider(InMemoryDataStoreProvider.ConnectionString, null, enablePoolingInConnectionString));
 }
コード例 #25
0
 protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args)
 {
     args.ObjectSpaceProviders.Add(new SecuredObjectSpaceProvider((SecurityStrategyComplex)Security, XPObjectSpaceProvider.GetDataStoreProvider(args.ConnectionString, args.Connection, true), false));
     args.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(TypesInfo, null));
 }
コード例 #26
0
 protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args)
 {
     // Zakomentowanie poniższej linii gwarantuje, że żadna baza danych nie będzie tworzona podczas włączenia aplikacji
     args.ObjectSpaceProviders.Add(new XPObjectSpaceProvider(XPObjectSpaceProvider.GetDataStoreProvider(args.ConnectionString, args.Connection, true), false));
     args.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(TypesInfo, null));
 }