Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Aspect Oriented Framework for features / build performances in .net [closed]

In various projects I worked with, we had to use some AOP or dependency injection framework.

We used Enterprise LIbrary, Unity and PostSharp.

For now, Postsharp is my best choice when it comes to the flexibiity I get over how I generate my aspects.

The only problem is the build time required once PostSharp is installed. My developpers don't like to pay the time tax even in regard of all the godness comming from PostSharp.

So my question is : What AOP framework would you recommand for fast build time AND great fonctionnality ?

Thanks, your answers are greatly appreciated,

Patrick

like image 219
PBelanger Avatar asked Oct 07 '09 19:10

PBelanger


People also ask

Is .NET framework same as .NET 6?

NET 6 can run on natively Mac and Linux, . NET Framework cannot and you would need a third-party runtime like Mono for that capability. . NET 6 you can compile the framework into your application so the separate framework does not need to be installed to run your app. .

Is .NET 6 the same as .NET core?

NET 6, though, is ASP.NET Core 6, a major upgrade of Microsoft's open source framework for building modern web applications. ASP.NET Core 6 is built on top of the . NET Core runtime and allows you to build and run applications on Windows, Linux, and macOS. ASP.NET Core 6 combines the features of Web API and MVC.

What is PostSharp used for?

PostSharp is the #1 pattern-aware extension to C# and VB. It allows developers to eradicate boilerplate by offloading repeating work from humans to machines. PostSharp contains ready-made implementations of the most common patterns and gives you the tools to build automation for your own patterns.

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.


1 Answers

PostSharp is a basically a full featured static weaver. That means the weaving takes place during the build process, in a post-compilation step. And for sure, it can takes some time. (Be sure to read Gael announcement about runtime performance improvements and build time performance improvements that will come with the version 2.0)

If you don't want any build time overhead, there is only one solution : use dynamic weavers. In .NET, there are several interception frameworks, like Castle.DynamicProxy, or Linfu.DynamicProxy. They generate proxies at runtime. Be aware that theses frameworks can't do as much as a static AOP framework like PostSharp can, and may also perform less efficiently at runtime. Very often, IoC frameworks offer dynamic interception capabilities (Spring.NET, Unity, Windsor, etc.)

One other solution is to look at hybrid weavers, which only weaves join points during the build process, in a static manner, and then allow you to apply aspect dynamically at runtime. Linfu.AOP, which uses Mono.Cecil as a backend, works like that.

like image 58
Romain Verdier Avatar answered Nov 03 '22 10:11

Romain Verdier