Open sandboxFocus

Class EditableObjectAttribute

Custom attribute that, when applied to a class, implements the IEditableObject interface in this class.

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))]
[Obsolete("[Recordable] aspect and its components are deprecated and will be removed in a future version.", false)]
[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 by undoing changes 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)

See Also