Could someone tell me if this would be safe to do?
If I had a context lets say M1. And I have two threads that will work on M1. One thread will only insert elelments into M1.TestTable1 and the other thread will only do Inserts on M1.TestTable2....will I have any issues doing this?
A threading question
Re: A threading question
Hey
I am not a DevArt guy, but maybe my answer will help you.
The DataContext itself is not thread safe. - So, I think, this is not a good idea.
But 2 thoughtful inputs
1) Split your DataContext into 2 Context's
2) Use Asycn Queries.
Hope this will help - Have a nice day
I am not a DevArt guy, but maybe my answer will help you.
The DataContext itself is not thread safe. - So, I think, this is not a good idea.
But 2 thoughtful inputs
1) Split your DataContext into 2 Context's
2) Use Asycn Queries.
Hope this will help - Have a nice day
Re: A threading question
Hmm two DataContexts...interesting idea.
I was initially thinking if it wasn't thread safe then to make a bunch of Lists (each would represent a different table) and do a Insert all after all the threads were done.
But I think I like your idea with using multiple Context's and will give that a try.
I was initially thinking if it wasn't thread safe then to make a bunch of Lists (each would represent a different table) and do a Insert all after all the threads were done.
But I think I like your idea with using multiple Context's and will give that a try.
Re: A threading question
DataContext objects are not thread-safe, at least because the DataContext instance uses a single connection, which is not thread-safe itself.
You can use two DataContext instances, as Zero-G. has advised.
JIC: generally, it is recommended to use a new DataContext object per each unit of work instead of keeping it for a long time.
You can use two DataContext instances, as Zero-G. has advised.
JIC: generally, it is recommended to use a new DataContext object per each unit of work instead of keeping it for a long time.