views:

122

answers:

2

Hi,

How do i create ambient objects in .NET that are available throughout a method chain. For e.g. the TransactionScope object.

+3  A: 

Take a look at the ThreadStaticAttribute or the CallContext class.

jsw
+4  A: 

If you are working with ASP.NET however you should look into HttpContext.Items because ASP.NET engine will switch threads while processing request.

Rashack