Ticket T569578
Visible to All Users

Is it possible to use XPO caching with the SecuredObjectSpaceProvider

created 7 years ago

[DevExpress Support Team: CLONED FROM K18356: How to use XPO caching in XAF]
Hi Anatol,

I am using a SecuredObjectSpaceProvider as shown in below code, is it possible to cached that without breaking the existing functionality of my code. If yes, then can you please show me how.

C#
protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args) { SecuredObjectSpaceProvider provider = new SecuredObjectSpaceProvider((ISelectDataSecurityProvider)Security, GetDataStoreProvider(args.ConnectionString, args.Connection)); args.ObjectSpaceProviders.Add(provider); } 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; }

Answers approved by DevExpress Support

created 7 years ago (modified 7 years ago)

Hi Mohammed,

The use of XPO caching should not break the existing functionality, so you can try it. Apply the following modifications to your code snippet to take advantage of the CachedDataStoreProvider component described in the K18356 article:

Replace

C#
dataStoreProvider = XPObjectSpaceProvider.GetDataStoreProvider(connectionString, connection, true);

With

C#
dataStoreProvider = new CachedDataStoreProvider(connectionString);

Also, I suggest that you check the following article: Security - How to reduce the number of permission requests and improve overall performance. The techniques described there can help you to improve performance in some scenarios.

Let me know if you have additional questions. I will be happy to answer them.

    Comments (1)

      Thanks Uriah. I will try out the solution once I get the system stable, i have got couple of tickets opened which are of high priority.

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.