ObjectDataProvider.Refresh() thread safe?

I am updating status information from several independent threads into a central status collection class. I have some of that status data bound to UI elements, and I've found that I need to call Refresh() in order to force the display to update. This is all fine and good, but I'm wondering if it is OK to call Refresh from several different threads.

The code seems to work OK, but I don't want some weird race condition cropping up as my code gets more complicated.




Answer this question

ObjectDataProvider.Refresh() thread safe?

  • firmlyfly

    Actually ObjectDataProvider.Refresh() method will handle the threading issues behind the scenes for you, Refresh() method will internally call BeginQuery() method which will delegate the query work to the appropriate thread based on value of IsAsynchronous property, and when the query work is done, the ObjectDataProvider will internally delegate the result back to the appropriate thread so that the result can be safely set on the ObjectDataProvider.Data property, so ObjectDataProvider has done everything for you, all you need to do is safely call the Refresh() method.

    Sheva


  • ObjectDataProvider.Refresh() thread safe?