Author: alaa9jo | Posted on: 10/19/2009 8:38:35 AM | Views : 308

Hi everyone,I've got a problem:
If I have a function Myfunction1 that calls A,B,C in a transaction,and MyFunction2 that calls C,B,A also as a transaction,If user1 called myfunction1 and another user called myfunction2 and at same time then a deadlock will appears...I'm using InstanceContextMode.PerCall and those A,B,C are doing transactions on DB...Insert,Update or delete etc. and I know why the deadlock happened {MyFunction1 needs to execute C and it's hold up by MyFunction2 and the later need to execute B while B is hold up by myfunction1}.

now,if I changed the InstanceContextMode to single then the problem disappear but another problem appears;Myfunction1 is used frequently unlike myfunction2 and using InstanceContextMode.Single will really slow things up for myfunction1.
How to manage this?!

...

Go to the complete details ...