Ticket T1066262
Visible to All Users

Is there any plans for a thread-safe data layer that also supports dynamic metadata?

created 3 years ago (modified 3 years ago)

[DevExpress Support Team: CLONED FROM T419520: How to troubleshoot the "Reentrancy or cross thread operation detected" error]

Is there any plans for a thread-safe data layer that also supports dynamic metadata? Right now I use SimpleDataLayer and set the deprecated SuppressReentrancyAndThreadSafetyCheck property to true. Whenever this property is finally taken down, I will have a huge problem on my hands.

Some context: I wrote classes and derived controls that makes it a breeze to create read-only, data bound list controls such as list boxes, grids and combo boxes with only little pieces of informations such as the name of a Sql Server view. They however rely heavily on a shared, long-living SimpleDataLayer instance upon which metadata is added on-the-go, like when a user navigates to a form that requires the information in a particular view to be obtained.

There's a lot of potential for reusing metadata. Stuff like list of products or customers comes around a lot from one UI to another. For this particular reason, I came to find out it's more efficient to work with just one datalayer and multiple sessions using that same datalayer.

I wished I could use ThreadSafeDataLayer, but the requirement that every single view used in every single data control in the whole application (hundreds of different UIs) is too steep. I need to keep it dynamic and keep the ability to query the data from a background thread if need be - of course while taking measures and full responsibility to prevent the UI thread from reacting to changes coming from a different thread.

I'd like a workaround that won't require me to review and rewrite code in hundreds of forms.

Answers approved by DevExpress Support

created 3 years ago (modified 3 years ago)

Hello David,

ThreadSafeDataLayer blocks metadata changes, because they can cause unexpected and erroneous behavior in multithreading cases.
To be able to customize metadata on the fly, use SimpleDataLayer. You can use the following solutions to avoid blocking of the UI in this case:

  1. Use async methods: FAQ: XPO Async/Await Method Support.
  2. Create a separate SimpleDataLayer for background operations.

Please let me know if you need any further assistance.

    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.