Class ChangeTrackingObject
This class allows to determine whether there are any changes to it's properties.
Implements
Namespace: Sartorius.SAF.Infrastructure
Assembly: Sartorius.SAF.dll
Syntax
public abstract class ChangeTrackingObject : ObservableObject, INotifyPropertyChanged, IDataErrorInfo, INotifyDataErrorInfo, INotifyDataPropertyChanged
Properties
View SourceHasChanges
Gets a value indicating whether this instance was changed.
Declaration
public bool HasChanges { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
View SourceAcceptChanges()
Sets HasChanges to false
.
Declaration
protected virtual void AcceptChanges()
Cascade()
Aggregates calls to CascadeChanges() and CascadeErrors().
Declaration
protected IDisposable Cascade()
Returns
Type | Description |
---|---|
System.IDisposable | An System.IDisposable that ends cascading when it's System.IDisposable.Dispose() method is called. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when this instance is already cascading. |
See Also
View SourceCascadeChanges()
Cascades the HasChanges property from child properties of type ChangeTrackingObject.
Declaration
protected IDisposable CascadeChanges()
Returns
Type | Description |
---|---|
System.IDisposable | An System.IDisposable that ends cascading when it's System.IDisposable.Dispose() method is called. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when this instance is already cascading. |
OnDataPropertyChanged(String)
Called when a data property is changed.
Declaration
protected override void OnDataPropertyChanged(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | The name of the property. |
Overrides
See Also
View SourceSetValue<T>(String, ref T, T, Action<T>, Action<T>, IEqualityComparer<T>)
Sets the given value if it is different to the given field using the provided System.Collections.Generic.IEqualityComparer<T>.
This will trigger a validation raise System.ComponentModel.INotifyPropertyChanged.PropertyChanged if field
and value
are not equal.
Declaration
protected override void SetValue<T>(string propertyName, ref T field, T value, Action<T> beforeChange, Action<T> afterChange, IEqualityComparer<T> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | The name of the property being changed. |
T | field | The field which should hold the property value. |
T | value | The new value. |
System.Action<T> | beforeChange | An action executed before the |
System.Action<T> | afterChange | An action executed after the |
System.Collections.Generic.IEqualityComparer<T> | comparer | The System.Collections.Generic.IEqualityComparer<T> used to compare the field and the new value. |
Type Parameters
Name | Description |
---|---|
T | The type of the property value. |