Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Is a DataSet threadsafe for merge and write?

Posted on 2007-03-31
6
Medium Priority
?
781 Views
Last Modified: 2013-12-16
Visual Studio DotNet 2005:
The question is whether a DataSet is threadsafe for merge and write.
It is a bet and we just need the answer "yes" or "no".
Sorry, cannot participate you in the win of the bet, as we need a an unbiased answer.
0
Comment
Question by:tm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 41

Expert Comment

by:graye
ID: 18829927
That's kinda a loaded question...   Are you talking about reads/writes to the in-memory represenation of the DataTables?   or are you talking about reads/writes to the underlying database.

Recall, it's the job of the underlying database (not ADO.Net) to ensure database integrity with concurrent writes.   Databases are free to use whatever record locking systems they need to make that happen.  

However, the read/writes to DataTables in the DataSet itself do not touch the underlying database... it just does it's thing with the in-memory represenation of the DataTables.
0
 

Author Comment

by:tm
ID: 18840045
The question does not address the underlying database, but the inimemory access to the DataTables in the DataSet. Whether these interactions are threadsafe for write and for merge.

Thanks - Thomas

0
 
LVL 41

Expert Comment

by:graye
ID: 18840142
Well, the documentation at http://msdn2.microsoft.com/en-us/library/system.data.dataset(VS.71).aspx

says...

Thread Safety
This type is safe for multithreaded read operations. You must synchronize any write operations

So, I'd consider that a definative anwer.
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 

Author Comment

by:tm
ID: 18840164
Obviously it means the it is save for read operation.
It may come to a linguistic interpretation for the write and merge operation:
Does that mean it is thread-safe or not?

Thanks - Thoams
0
 
LVL 41

Accepted Solution

by:
graye earned 500 total points
ID: 18840498
The documentation says that "write operations" are *not* thread safe...   So, in my mind that includes write and merge operations.

But, on the other hand, what do you mean by "write and merge".  

        Are you referring to a DataTable.Row changes (insert, delete, modify) as a "write"?
        Are you referring to a DataSet.Merge operation where changes to one DataTable are reflected in another as "merge"?

If so, then those are both "write operations" because they perform actions that trigger RowChange events.  (that's a pretty good definition of "write" in this context)
0
 

Author Comment

by:tm
ID: 18840708
Graye, great explanation - thanks very much!
And beside helping me better understand it, it makes me win a bottle of wine. If once you are in North Carolina, I'd like to share it with you.
Thanks.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question