Class BeingDirtyBase
Provides a base implementation of ICanBeDirty and IRememberBeingDirty.
Inheritance
Namespace: Umbraco.Core.Models.Entities
Assembly: Umbraco.Core.dll
Syntax
[Serializable]
[DataContract(IsReference = true)]
public abstract class BeingDirtyBase : IRememberBeingDirty, ICanBeDirty
Methods
View SourceDetectChanges<T>(T, T, String, IEqualityComparer<T>, Boolean)
Detects changes and manages the dirty flag.
Declaration
protected void DetectChanges<T>(T value, T orig, string propertyName, IEqualityComparer<T> comparer, bool changed)
Parameters
Type | Name | Description |
---|---|---|
T | value | The new value. |
T | orig | The original value. |
System.String | propertyName | The property name. |
System.Collections.Generic.IEqualityComparer<T> | comparer | A comparer to compare property values. |
System.Boolean | changed | A value indicating whether we know values have changed and no comparison is required. |
Type Parameters
Name | Description |
---|---|
T | The type of the value. |
DisableChangeTracking()
Disables change tracking.
Declaration
public void DisableChangeTracking()
EnableChangeTracking()
Enables change tracking.
Declaration
public void EnableChangeTracking()
GetDirtyProperties()
Gets properties that are dirty.
Declaration
public virtual IEnumerable<string> GetDirtyProperties()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> |
GetWereDirtyProperties()
Gets properties that were dirty.
Declaration
public virtual IEnumerable<string> GetWereDirtyProperties()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> |
IsDirty()
Determines whether the current entity is dirty.
Declaration
public virtual bool IsDirty()
Returns
Type | Description |
---|---|
System.Boolean |
IsPropertyDirty(String)
Determines whether a specific property is dirty.
Declaration
public virtual bool IsPropertyDirty(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName |
Returns
Type | Description |
---|---|
System.Boolean |
OnPropertyChanged(String)
Registers that a property has changed.
Declaration
protected virtual void OnPropertyChanged(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName |
ResetDirtyProperties()
Resets dirty properties.
Declaration
public virtual void ResetDirtyProperties()
Remarks
Saves dirty properties so they can be checked with WasDirty.
ResetDirtyProperties(Boolean)
Resets dirty properties.
Declaration
public virtual void ResetDirtyProperties(bool rememberDirty)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | rememberDirty | A value indicating whether to remember dirty properties. |
Remarks
When rememberDirty
is true, dirty properties are saved so they can be checked with WasDirty.
ResetWereDirtyProperties()
Resets properties that were dirty.
Declaration
public virtual void ResetWereDirtyProperties()
SetPropertyValueAndDetectChanges<T>(T, ref T, String, IEqualityComparer<T>)
Sets a property value, detects changes and manages the dirty flag.
Declaration
protected void SetPropertyValueAndDetectChanges<T>(T value, ref T valueRef, string propertyName, IEqualityComparer<T> comparer = null)
Parameters
Type | Name | Description |
---|---|---|
T | value | The new value. |
T | valueRef | A reference to the value to set. |
System.String | propertyName | The property name. |
System.Collections.Generic.IEqualityComparer<T> | comparer | A comparer to compare property values. |
Type Parameters
Name | Description |
---|---|
T | The type of the value. |
WasDirty()
Determines whether the current entity is dirty.
Declaration
public virtual bool WasDirty()
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
A property was dirty if it had been changed and the changes were committed.
WasPropertyDirty(String)
Determines whether a specific property was dirty.
Declaration
public virtual bool WasPropertyDirty(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
A property was dirty if it had been changed and the changes were committed.
Events
View SourcePropertyChanged
Occurs when a property changes.
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type | Description |
---|---|
System.ComponentModel.PropertyChangedEventHandler |