开发者

Multi-threading access to SubmitChanges() (LINQ to SQL)

I am using Visual Studio 2010 Beta 2.

In Parallel.For loop I execute the same method with different parameter values. After execution processed data must be stored in the database.

But I've got an exception hat says that I could not work with the same data context from different threads.

So the question will be how to work with data context and SubmitChanges() fro开发者_JS百科m multiple threads?


I would recommend creating a threadsafe structure for storing your results. Once your parallel for has completed you can read these out of the structure and push them into your linq dataset.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜