.... Read the documentation!
I've just very nearly shot myself in the foot with a
ConfigurationSectionHandler. I've got a DHTML menu which I generate
based on information in the web config file and some contextual
information. So, don't show a link to the current page, don't show a
link to anything the user hasn't rights to see, show some links only
when logged in, show some links only when not logged in. Fair enough.
I've just been writing another menu to use the same data, and decided to
factor out the logic to determine which links to show. The
ConfigurationSectionHandler constructs a tree(like) structure which the
menu classes navigate recursively using foreach. I'll just set some
instance variables to hold the contextual information and write an
enumerator which uses that to....
Sudden realisation that a breakpoint in the creation code wasn't being
hit. Suspicion that this structure was being created once at startup.
Checked the documentation. Stateless, thread safe and immutable. Ouch.
Easily fixed with the memento pattern, and actually much cleaner code
than the smart enumerator would have been, but still, very close to
introducing a horrendous bug. Easily done, isn't it?
--
Steve Walker