Custom attribute that, when applied to a class, implements IEditableObject into this class.
Inheritance
EditableObjectAttribute
Implements
Namespace: PostSharp.Patterns.Recording
Assembly: PostSharp.Patterns.Model.dll
Syntax
[MulticastAttributeUsage(MulticastTargets.Class, TargetTypeAttributes = MulticastAttributes.UserGenerated)]
[IntroduceInterface(typeof(IEditableObject), OverrideAction = InterfaceOverrideAction.Ignore, LinesOfCodeAvoided = 5)]
[Metric("UsedFeatures", "PostSharp.Patterns.Recording.EditableObject")]
[AspectTypeDependency(AspectDependencyAction.Require, AspectDependencyPosition.Before, typeof(RecordableAttribute))]
[Serializer(typeof(EditableObjectAttribute.Serializer))]
public sealed class EditableObjectAttribute : InstanceLevelAspect, ITypeLevelAspect, ITypeLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation, ICloneAwareAspect, IInstanceScopedAspect, IEditableObject, IAspectProvider, IAspect, IService
Remarks
This aspect implicitly adds the RecordableAttribute aspect to the target class, unless the aspect is already applied to this class.
The aspect is implemented by creating a restore point using the AddRestorePoint(string) method in the BeginEdit() method, and undo using UndoTo(Operation) when the CancelEdit() method is invoked. The restore point is removed using Remove() after invoking CancelEdit() and EndEdit()
The implementation assumes that no other object being tracked by the same Recorder will be modified between calls to BeginEdit() and CancelEdit(), otherwise changes to these other objects will be canceled as well.
Constructors
Name | Description |
---|---|
EditableObjectAttribute() | |
EditableObjectAttribute(PortableFormatterConstructorContext) |