I have an object handed into our library and passed through various processes. I need to attach some additional information to these objects as they pass through various stages and out the other end - a kind of dynamic decorator pattern, I guess, except adding additional properties rather than changing existing behaviour.
I was hoping to use LinFu or Castle to create a dynamic proxy and implement an additional interface on the object to store this. Components that know about the extended interface could cast and access it - whilst those that are not are oblivious, as the underlying type has not changed.
However, I hadn't appreciated that all these mechanisms assume you have control over the point at which the type is initially created - which I don't.
Does anyone have suggestions on how I could better approach this?
Many thanks