Base class for all aspects applied on assemblies.
Inheritance
Implements
Namespace: PostSharp.Aspects
Assembly: PostSharp.dll
Syntax
[MulticastAttributeUsage(MulticastTargets.Assembly)]
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
[Serializer(null)]
public abstract class AssemblyLevelAspect : Aspect, IAspectBuildSemantics, IValidableAnnotation, IAssemblyLevelAspect, IAssemblyLevelAspectBuildSemantics, IAspectRemarks
note
This class does not provide any advice. You may derive your aspect class from a Developing Simple Aspects, or build a Developing Member-Level Aspects or a Developing Type- and Assembly-Level Aspects with advice methods.
An assembly-level aspect can also implement IAspectProvider to add aspects to the assembly programmatically, for instance a ManagedResourceIntroductionAspect that embeds a managed resource computed at build time.
An advice cannot apply to the assembly itself, and MulticastPointcut selects no member from an assembly. To add advices to types or members of the assembly, apply a TypeLevelAspect, MethodLevelAspect or LocationLevelAspect to them, by multicasting or through IAspectProvider. The advices that introduce or import members need a type.
note
All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute. Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When another aspect serializer (such as MsilAspectSerializer) is used, it is not necessary to mark the aspect class as serializable. For more information, see Understanding Aspect Serialization.
Constructors
| Name | Description |
|---|---|
| AssemblyLevelAspect() |
Methods
| Name | Description |
|---|---|
| CompileTimeInitialize(Assembly, AspectInfo) | Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method. |
| CompileTimeValidate(object) | Method invoked at build time to ensure that the aspect has been applied to the right target. |
| CompileTimeValidate(Assembly) | Method invoked at build time to ensure that the aspect has been applied to the right target. |
| SetAspectConfiguration(AspectConfiguration, object) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. |
| SetAspectConfiguration(AspectConfiguration, Assembly) | Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect. |