Thread static variables and passing parents, etc

Thread static variables and passing parents, etc

Old forum URL: forums.lhotka.net/forums/t/909.aspx


paultyng posted on Tuesday, August 15, 2006

I recently read this article on MSDN: http://msdn.microsoft.com/msdnmag/issues/06/09/NETMatters/default.aspx

It gave an example of a simple implementation of a TransactionScope style method for passing data around.  This is kind of similar to our authorization and changed events in which they perform stack walks to determine what property is calling the CanRead or PropertyChanged methods. 

I wanted to use something similar to pass parent information or root object stack information to child objects in their insert / update methods, they can just look at what parent is available in the scope of the call. In addition to parent / root information, I had needed to pass some audit information around as well, so if this works properly, it would alleviate the need for me to modify these methods.

Assuming no multi threading in my data methods, does anyone see any issues with passing data like this instead of explicitly passing it to the Insert / Update methods?

Copyright (c) Marimer LLC