示例#1
0
        private void CreateXPObjectSpaceProvider(string connectionString, CreateCustomObjectSpaceProviderEventArgs e)
        {
            HttpApplicationState  application       = (HttpContext.Current != null) ? HttpContext.Current.Application : null;
            IXpoDataStoreProvider dataStoreProvider = null;

            if (application != null && application["DataStoreProvider"] != null)
            {
                dataStoreProvider     = application["DataStoreProvider"] as IXpoDataStoreProvider;
                e.ObjectSpaceProvider = new XPObjectSpaceProvider(dataStoreProvider, true);
            }
            else
            {
                if (!String.IsNullOrEmpty(connectionString))
                {
                    connectionString  = XpoDefault.GetConnectionPoolString(connectionString);
                    dataStoreProvider = new ConnectionStringDataStoreProvider(connectionString, true);
                }
                else if (e.Connection != null)
                {
                    dataStoreProvider = new ConnectionDataStoreProvider(e.Connection);
                }
                if (application != null)
                {
                    application["DataStoreProvider"] = dataStoreProvider;
                }
                e.ObjectSpaceProvider = new XPObjectSpaceProvider(dataStoreProvider, true);
            }
        }
示例#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
            {
                if (!String.IsNullOrEmpty(connectionString))
                {
                    connectionString  = DevExpress.Xpo.XpoDefault.GetConnectionPoolString(connectionString);
                    dataStoreProvider = new ConnectionStringDataStoreProvider(connectionString, true);
                }
                else if (connection != null)
                {
                    dataStoreProvider = new ConnectionDataStoreProvider(connection);
                }
                if (application != null)
                {
                    application["DataStoreProvider"] = dataStoreProvider;
                }
            }
            return(dataStoreProvider);
        }
示例#3
0
        private IXpoDataStoreProvider GetDataStoreProvider(string connectionString, IDbConnection connection)
        {
            var application = HttpContext.Current != null ? HttpContext.Current.Application : null;
            IXpoDataStoreProvider dataStoreProvider = null;

            if (application != null && application["DataStoreProvider"] != null)
            {
                dataStoreProvider = application["DataStoreProvider"] as IXpoDataStoreProvider;
            }
            else
            {
                if (!string.IsNullOrEmpty(connectionString))
                {
                    connectionString  = XpoDefault.GetConnectionPoolString(connectionString);
                    dataStoreProvider = new ConnectionStringDataStoreProvider(connectionString, true);
                }
                else if (connection != null)
                {
                    dataStoreProvider = new ConnectionDataStoreProvider(connection);
                }
                if (application != null)
                {
                    application["DataStoreProvider"] = dataStoreProvider;
                }
            }
            return(dataStoreProvider);
        }
示例#4
0
        private IXpoDataStoreProvider GetDataStoreProvider(string connectionString, System.Data.IDbConnection connection)
        {
            IXpoDataStoreProvider dataStoreProvider = null;

            if (!String.IsNullOrEmpty(connectionString))
            {
                dataStoreProvider = new ConnectionStringDataStoreProvider(connectionString);
            }
            else if (connection != null)
            {
                dataStoreProvider = new ConnectionDataStoreProvider(connection);
            }
            return(dataStoreProvider);
        }
示例#5
0
 private void CreateXPObjectSpaceProvider(string connectionString, CreateCustomObjectSpaceProviderEventArgs e)
 {
     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;
         e.ObjectSpaceProvider = new XPObjectSpaceProvider(dataStoreProvider, true);
     }
     else {
         if(!String.IsNullOrEmpty(connectionString)) {
             connectionString = DevExpress.Xpo.XpoDefault.GetConnectionPoolString(connectionString);
             dataStoreProvider = new ConnectionStringDataStoreProvider(connectionString, true);
         }
         else if(e.Connection != null) {
             dataStoreProvider = new ConnectionDataStoreProvider(e.Connection);
         }
         if (application != null) {
             application["DataStoreProvider"] = dataStoreProvider;
         }
         e.ObjectSpaceProvider = new XPObjectSpaceProvider(dataStoreProvider, true);
     }
 }
示例#6
0
        /// <summary>
        /// Handles the CreateCustomObjectSpaceProvider event of the application control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DevExpress.ExpressApp.CreateCustomObjectSpaceProviderEventArgs"/> instance containing the event data.</param>
        private void application_CreateCustomObjectSpaceProvider(object sender,
                                                                 CreateCustomObjectSpaceProviderEventArgs e)
        {
            IXpoDataStoreProvider dataStoreProvider = null;

            if (providerFactory != null)
            {
                dataStoreProvider = providerFactory.CreateDataStoreProvider(e.Connection, e.ConnectionString);
            }
            if (dataStoreProvider == null)
            {
                if (e.Connection == null)
                {
                    dataStoreProvider = new ConnectionStringDataStoreProvider(e.ConnectionString);
                }
                else
                {
                    dataStoreProvider = new ConnectionDataStoreProvider(e.Connection);
                }
            }
            e.ObjectSpaceProvider = new ObjectSpaceProvider(dataStoreProvider);
        }
示例#7
0
 /// <summary>
 /// Handles the CreateCustomObjectSpaceProvider event of the application control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="DevExpress.ExpressApp.CreateCustomObjectSpaceProviderEventArgs"/> instance containing the event data.</param>
 private void application_CreateCustomObjectSpaceProvider(object sender, 
     CreateCustomObjectSpaceProviderEventArgs e)
 {
     IXpoDataStoreProvider dataStoreProvider = null;
     if(providerFactory != null)
         dataStoreProvider = providerFactory.CreateDataStoreProvider(e.Connection, e.ConnectionString);
     if (dataStoreProvider == null)
     {
         if (e.Connection == null)
             dataStoreProvider = new ConnectionStringDataStoreProvider(e.ConnectionString);
         else
             dataStoreProvider = new ConnectionDataStoreProvider(e.Connection);
     }
     e.ObjectSpaceProvider = new ObjectSpaceProvider(dataStoreProvider);
 }