One starts to define an Aspect by applying the [Aspect]
attribute onto a given class. The class decorated with an aspect cannot be abstract
, static
, and generic. Otherwise you’ll get an error.
[Aspect(Scope.Global)]
class Log
{
}
There are currently two scopes in which aspect can operate:
In addition, your aspect can be created either with a parameterless constructor or factory. Make sure the factory class has a method with the proper signature:
[Aspect(Scope.Global, Factory = typeof(AspectFactory))]
class Log
{
}
class AspectFactory
{
public static object GetInstance(Type type)
{
}
}
Next step is to define how your Aspect interacts with injection targets. You can achieve this by using Mixin and/or Advice effects.