Question

I can implement both AOP (using Postsharp) and the EntLib (v5.0) for cross cutting concerns as logging and exception handling/strategies.

I'm failing to see if one excludes the other or where they might complement each other. Can somebody please share some experience and/or thoughts on this?

Thanks!

My take on it regarding exceptions:

AOP can easily wrap your code and catch exceptions. Handling could then be delegated to the EntLib which provides strong handling (wrap, replace, swallow) configuration using policies.

The handling strategies (wrap, replace and swallow) could also be implemented in aspects. What would drive the decision? Or am I missing something here perhaps?

Was it helpful?

Solution

I have not used Enterprise Lib, so let me talk in terms of log4net and postsharp.

Log4net has great logging stuff, and you can use AOP ( using postsharp ) to drive this logging in a declarative way. In this sense they are great compliments.

Here is an example. I would expect the same to hold true for Enterprise Library based logging or exception handling.

What I wouldn't suggest you use is the two AOP type things together, so the policy injection in Enterprise Library looks like AOP to me, so I wouldn't use it and postsharp.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top