MetalamaAPI documentationPost­Sharp API migrationPost­Sharp.​AspectsInstance­Level­Aspect
Open sandboxFocus

InstanceLevelAspect Class

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]
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).