Static assembly initialization

Posted by ph0enix on Stack Overflow See other posts from Stack Overflow or by ph0enix
Published on 2010-03-11T04:38:22Z Indexed on 2010/03/11 4:39 UTC
Read the original article Hit count: 176

I'm attempting to develop an Interceptor framework (in C#) where I can simply implement some interfaces, and through the use of some static initialization, register all my Interceptors with a common Dispatcher to be invoked at a later time.

The problem lies in the fact that my Interceptor implementations are never actually referenced by my application so the static constructors never get called, and as a result, the Interceptors are never registered.

If possible, I would like to keep all references to my Interceptor libraries out of my application, as this is my way of (hopefully) enforcing loose coupling across different modules.

Hopefully this makes some sense. Let me know if there's anything I can clarify...

Does anyone have any ideas, or perhaps a better way to go about implementing my Interceptor pattern?

TIA,
Jeremy

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET