Open sandboxFocus

Enum InitializerPosition

Specifies the position of an initializer relative to the call to the base initializer, in advice operations that support it, i.e. AfterObjectInitializer and AfterLastInstanceConstructor.

Namespace: Metalama.Framework.Advising
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public enum InitializerPosition
Remarks

Initialization advice of those kinds emits a method (Initialize or OnConstructed) that calls base.Initialize(...) or base.OnConstructed(...) when applicable. Templates can be placed before or after that base call, matching the matryoshka-doll convention used throughout Metalama for ordering aspects: outer aspects observe inner aspects' effects both before and after the call.

Across aspect instances, AfterBase templates run in compile-time order (first-applied aspect first, innermost layer of the matryoshka), while BeforeBase templates run in run-time order (last-applied aspect first, outermost layer). Within a single aspect instance, multiple AddInitializer calls preserve their programmatic add-order in both positions.

Fields

Name Description
AfterBase

The initializer runs after the call to the base initializer (base.Initialize(...) or base.OnConstructed(...)). This is the default.

BeforeBase

The initializer runs before the call to the base initializer.

See Also