Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

Using UnitOfwork and parallell tasks #18

Open
marvealmar opened this issue Sep 6, 2010 · 3 comments
Open

Using UnitOfwork and parallell tasks #18

marvealmar opened this issue Sep 6, 2010 · 3 comments

Comments

@marvealmar
Copy link

Hi,
I have the following problem:
I have an application which does extensive work. Until now all this have been done synchronously. But then I identified task that may as well run in parallell. Therefore I wanted to use the .net 4.0 parallell/task library. But when setting up this, I first get a problem with the UnitOfWorkScope. Running tasks in their own thread seems to loose the current UnitOfWorkScope I run the complete task in.
So I then try to create a new scope within the working thread for the individual tasks, but then I received error "The underlying provider failed on EnlistTransaction".

I guess if I were able to get hold of the UnitOfWorkScope across threads, it would go well.

any solution/workaround to this?

@marvealmar
Copy link
Author

Found a workaround. In my configuration of the repository I was using the DefaultStateConfiguration, and using a ThreadLocalStore for state storage.
I implemented a new Store (ThreadSafe) by using the Synchronizer class from IDesign.
Using this, the current TransactionMAnager/UnitOfWorkScope will be loaded from the store.

@saurabhsharma81
Copy link

Hi,
Can I have the implementation of the Store(ThreadSafe), I am also facing the same issue.
[email protected]

@marvealmar
Copy link
Author

Hi,
I am sorry. I had this source code implemented at my former employer. I did not bring the source code with me:)

Another thing is that, if I were you, consider to not use NCommon. It has a lots of great ideas and implementations, but is seems to be a dead project and poorly documented (or samples).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants