Open sandboxFocus

Class InstanceLevelAspect

In Metalama, use TypeAspect. Note that aspects in Metalama have no run-time existence, so they cannot be instance-scoped. While porting a PostSharp InstanceLevelAspect into Metalama, you would typically introduce instance fields or properties into the target type, and use an initializer to initialize them.

Inheritance
InstanceLevelAspect
Namespace: PostSharp.Aspects
Assembly: Metalama.Migration.dll
Syntax
[MulticastAttributeUsage(MulticastTargets.Class, TargetTypeAttributes = MulticastAttributes.Instance)]
[AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = true)]
[Obsolete("In Metalama, use 'TypeAspect'. Note that aspects in Metalama have no run-time existence, so they cannot be instance-scoped. While porting a PostSharp 'InstanceLevelAspect' into Metalama, you would typically introduce instance fields or properties into the target type, and use an initializer to initialize them.", false)]
public abstract class InstanceLevelAspect : TypeLevelAspect, ITypeLevelAspect, ITypeLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation, ICloneAwareAspect, IInstanceScopedAspect, IAspect

Constructors

Name Description
InstanceLevelAspect()

Properties

Name Description
Instance

Use meta.This.

Methods

Name Description
CreateAspectConfiguration()

Not supported in Metalama.

CreateInstance(AdviceArgs)

No equivalent in Metalama.

OnCloned(ICloneAwareAspect)

Not implemented in Metalama.

RuntimeInitializeInstance()

Typically, add an initializer using builder.Advice.AddInitializer(INamedType, string, InitializerKind, object?, object?).