aoppostsharpaspects

Can I enable/disable aspects from an external application?


Supposing I have two applications, one that has features based on aspect oriented programming such as authentication, authorization, logging, exception handling etc. and the other one that connects to the previous application and has buttons that enable/disable aspects. Is there a way that I can do this? (while the AOP app is running)


Solution

  • You could write your program such that logging is disabled if some (global static) property is false. Of course then this effectively disables logging. (and yes you could write this behavior in 1 or many aspects)

    However a AOP app is a compiled program, and aspects are just compiled code. There is no "now run the program as if the aspect wern't compiled in".And even if you recompiled your code you wouldn't be guaranteed everything just worked (except the logging). Some aspects can modify inputs that your program relies on for example. without the aspects your program might just crash.