I would like to create a scope object that act similar to transactionscope.
public void MyOperation ()
{
using(Scope s = new Scope())
{
Function1();
Function2();
}
}
Function1 and function2 are in the scope and they can know evertyhing about the scope variable and it can also generate an unique id of the scope.
It is exactly like transactionscope, but I don’t wanna get my sql lock down.
Note that static variable is not a solution since it is running in IIS
Can somebody help me on that?
You need to use a
[ThreadStatic]static field.If you’re only running in ASP.Net, you should probably use
HttpContext.Current.Itemsinstead.