Mr. Advice is an open source (and free of charge) alternative to PostSharp (which is still far more advanced, see https://www.postsharp.net).
It intends to inject aspects at build-time. Advices are written in the form of attributes, and marking methods with them makes the pointcut, resulting in a nice and easy aspect injection.
More information about what is an aspect at Wikipedia.
Mr. Advice can weave assemblies for:
Mr. Advice allows you to:
It is available as a package. There is also an automatic build with tests at appveyor. The current status is
Currently, MrAdvice won't bring you any aspect out-of-the-box.
This means you'll have to write your own aspects (however you can see below other packages using Mr. Advice).
So it brings us to the next chapter, which is...
Here is the minimal sample:
public class MyProudAdvice : Attribute, IMethodAdvice
{
public void Advise(MethodAdviceContext context)
{
// do things you want here
context.Proceed(); // this calls the original method
// do other things here
}
}
You then just need to mark the method(s) with the attribute and that's it, your aspect is injected!
[MyProudAdvice]
public void MyProudMethod()
{
}
Your aspects can be injected at assembly, type or method level, simply by setting the attribute:
NuGet packages:
Miscellaneous projects:
Project owner is picrap, feel free to drop a mail :email:.
Project company is Arx One, a french company editor of backup software solutions.