Current filter:
                                You should refresh the page.
                                Support Center

                                1 Solution

                                Creation Date Rating Importance Sort by


                                Additional information:

                                The following code is now added by the Solution Wizard to the Global.asax.cs file for XPO-based applications (the behavior of existing applications is not changed):

                                protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args) {     CreateXPObjectSpaceProvider(args.ConnectionString, args);     args.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(TypesInfo, null)); } 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);     } }

                                A single IXpoDataStoreProvider and IDataStore are created per each database, and they are shared by all users. Note that the true value is passed to the useCachedDataStore parameter of the ConnectionStringDataStoreProvider constructor. This parameter specifies if the cached IDataStore instance is used or a new IDataStore instance is created per each CreateWorkingStore method call.

                                When Object Space Providers are created in the overridden CreateDefaultObjectSpaceProvider method, providers (and their connections) are disposed of when the application is disposed of (e.g. on re-logon). When providers are created using the CreateCustomObjectSpaceProvider event, providers and their connections are disposed of together with their application too. Set the event's CreateCustomObjectSpaceProviderEventArgs.IsObjectSpaceProviderOwner parameter to false to cancel dispose of providers together with the application in this scenario:

                                private void Instance_CreateCustomObjectSpaceProvider(object sender, CreateCustomObjectSpaceProviderEventArgs e) { IXpoDataStoreProvider dataStoreProvider = null; if(Application["DataStoreProvider"] != null) { dataStoreProvider = Application["DataStoreProvider"] as IXpoDataStoreProvider; e.ObjectSpaceProvider = new SecuredObjectSpaceProvider((ISelectDataSecurityProvider)WebApplication.Instance.Security, dataStoreProvider, true); } else { if(!String.IsNullOrEmpty(e.ConnectionString)) { string connectionString = DevExpress.Xpo.XpoDefault.GetConnectionPoolString(e.ConnectionString); dataStoreProvider = new ConnectionStringDataStoreProvider(connectionString, true); } else if (e.Connection != null){ dataStoreProvider = new ConnectionDataStoreProvider(e.Connection); } Application["DataStoreProvider"] = dataStoreProvider; e.ObjectSpaceProvider = new SecuredObjectSpaceProvider((ISelectDataSecurityProvider)WebApplication.Instance.Security, dataStoreProvider, true); } e.IsObjectSpaceProviderOwner = false; }
                                • Gustavo Marzioni 11.16.2015

                                  May I use this modifications in 15.1.8?

                                • Konstantin B (DevExpress) 11.16.2015
                                  Gustavo, this functionality is not available in 15.1.8. Please wait till the major update version 15.2 is released.
                                • Nikolay Bobrovskiy 1 12.03.2015

                                  Why is "e.IsObjectSpaceProviderOwner = true" placed in "else" block only?

                                • Alex Gn (DevExpress) 12.04.2015

                                  Hello Nikolay,
                                  Thank you for your comment. I have corrected the original answer.

                                If you need additional product information, write to us at or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2017 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners