Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

Question: for SmartInspect + AOP, do you recommend PostSharp or Unity?



I’d like to know whether

I have a large project with a log of classes, spread out over a few projects, some of them remote (i.e. WCF). The classes as are a mixture of static and non-static.

I’d like to add logging for method entry/exit to the project.

Would it be easier to use PostSharp or Unity to add SmartInspect logging using AOP?


Hello Gravitas,

Thanks for your message. If you are mainly interested in AOP, I recommend trying out PostSharp. We have a ready-to-use PostSharp library for SmartInspect on our website here:

PostSharp implements the AOP functionality by simply specifying attributes for methods, classes or entire assemblies. Unity on the other hand requires that you instantiate all classes through their dependency injection framework in order to use the AOP functionality. As far as I know this also wouldn’t work with static classes.

I suggest taking a look at PostSharp and see how it works for you.