Metalama's equivalent to PostSharp's [NotifyPropertyChanged] aspect is the [Observable]. For details, see Metalama.Patterns.Observability.
Metalama's implementation strategy is completely different from PostSharp's. Where PostSharp maintained an in-memory dependency graph at runtime, Metalama does most of the work at build time and doesn't maintain complex data structures at runtime.
API mapping
Most features of PostSharp's [NotifyPropertyChanged] aspect are available in Metalama under a different name:
| PostSharp | Metalama |
|---|---|
NotifyPropertyChangedAttribute |
ObservableAttribute |
PureAttribute |
ConstantAttribute |
SafeForDependencyAnalysisAttribute |
SuppressObservabilityWarningsAttribute or #pragma warning disable |
IgnoreAutoChangeNotificationAttribute |
NotObservableAttribute |
INotifyChildPropertyChanged |
OnChildPropertyChanged protected method. |
Feature gaps
The following features haven't been implemented in Metalama yet:
- You can't implement the
INotifyPropertyChanginginterface. - The
PropertyChangedevents can't be implemented as weak events—they hold references to their handlers. - Suppression of false positives isn't implemented—the
PropertyChangedevent can be signaled even when there's no change in the property.