Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best implementation for AOP in .Net? [closed]

Tags:

.net

aop

There is a lot of AOP implementation in C#, VB.net. this is some of AOP Implementations:

  • PostSharp
  • Castle DynamicProxy
  • LinFu
  • LOOM.NET
  • Aspect.NET
  • Enterprise Library 3.0 Policy Injection Application Block
  • AspectDNG
  • DotSpect (.SPECT)
  • The Spring.NET Framework as part of its functionality
  • Wicca and Phx.Morph
  • An exhaustive analysis on AOSD solutions for .NET is available from Twente University
  • Seasar.NET
  • Aspect#
  • Puzzle.NAspect
  • Compose*
  • SetPoint
  • NConcern .NET AOP Framework
  • ...

What is the best implementation for AOP in .Net? What I should use?

like image 451
ecleel Avatar asked Mar 11 '09 08:03

ecleel


People also ask

What is Aspect Oriented Programming C#?

"Aspect Oriented Programming is a methodology to separate cross cut code across different modules in a software system." In short all the cross cut code is moved to a separate module, thus increasing more modularity and bringing in ease of maintenance.

What is Aspect Oriented Programming in spring?

Aspect-Oriented Programming (AOP) complements Object-Oriented Programming (OOP) by providing another way of thinking about program structure. The key unit of modularity in OOP is the class, whereas in AOP the unit of modularity is the aspect.

What happened to Aspect Oriented Programming?

It is still in use mainly for logging and opening/closing database translations by several java frameworks (Spring for example, Roo). Problem with AOP is that if you overuse it, your program will be hard to maintain.. especially for new developers which will have no clue why particular code is being called and by who..


2 Answers

I think that Castle Dynamic Proxy is the solution of choice if dynamic interception can handle your needs. This framework is used internally by a lot of other frameworks that want to offer AOP capabilities. Typically, most of existing IoC containers now provide some dynamic interception mechanisms (Spring.NET, Castle Windsor, StructureMap, etc.) If you already work with an IoC container, maybe it could be easier to look at what it proposes.

If dynamic interception can't address your needs (weaving sealed class, intercepting non-virtual call, etc.), then you certainly want static weaving. PostSharp is the reference in this domain.

Note that it also exists Linfu, that can be used to leverage both AOP fashions.

like image 145
Romain Verdier Avatar answered Sep 19 '22 18:09

Romain Verdier


"Best" is subjective.

First, draw up a list of the features you need, your architecture, etc. Then look for options that do what you need, without introducing unnecessary complexity. For example, several are interface oriented: is your code currently interface oriented? If not, PostSharp might be a better choice (being weaved into the original classes). But of course, PostSharp can't be configured at runtime... horses for courses.

like image 38
Marc Gravell Avatar answered Sep 22 '22 18:09

Marc Gravell