c# - Passing TransactionScope to tasks created by Parallel.Invoke -


I need TxJobs , which are running in parallel, creating a scope for this parental transaction for . How do I make this work?

 using  (var tx = TransactionScope ()) {Parallel.Invoke (TxJob1, TxJob2); Tx.Complete (); } {Var tx = new TransactionScope ()) by using  DependentClone :  
  {var dtx1 = Transaction .Full: Duplicate Clone (Dependable Clonoption Rollback Implant Complete); Var dtx2 = Transaction.Current.DependentClone (DependentCloneOption.RollbackIfNotComplete); Parallel Invoke (() => txjb1 (dtx1), () => txjb2 (dtx2); Tx.Complete (); }  and in the  TxJob2  methods, this works if I just  complete  to    

> DependentClones . However, if I create a scope from the clone, then I will be using transaction_bortedException :

  void TxJob1 (transaction dt) {(var tx = new TransactionScope (dt)) Is achieved by. {Console.light line (dtx transass information local identifier); Tx.Complete (); }}   

The exception is raised by the call method in full , not in TxJobs . Why is this unsuccessful?

[edit] If I explicitly call DependentTransaction in TxJobs, then it works. If I do not make a full call on the new TransactionScope in TxJobs (a rollback trigger), the parent transaction fails. It seems that I have to call both the transaction object. I

It seems that I am a dependent clone and Both the TransactionScope have to make a full call. MS does the same in itself.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -