Class Delta<TEntityType>
A class the tracks changes (i.e. the delta) for a particular TEntityType
.
public class Delta<TEntityType> : TypedDelta, IDynamicMetaObjectProvider, IDelta where TEntityType : class
Type Parameters
TEntityType
TEntityType is the base type of entity this delta tracks changes for.
- Inheritance
-
Delta<TEntityType>
- Implements
- Inherited Members
Constructors
Delta()
Initializes a new instance of Delta<TEntityType>.
public Delta()
Delta(Type)
Initializes a new instance of Delta<TEntityType>.
public Delta(Type entityType)
Parameters
entityType
TypeThe derived entity type for which the changes would be tracked.
entityType
should be assignable to instances ofTEntityType
.
Delta(Type, IEnumerable<string>)
Initializes a new instance of Delta<TEntityType>.
public Delta(Type entityType, IEnumerable<string> updatableProperties)
Parameters
entityType
TypeThe derived entity type for which the changes would be tracked.
entityType
should be assignable to instances ofTEntityType
.updatableProperties
IEnumerable<string>The set of properties that can be updated or reset.
Properties
EntityType
Gets the actual type of the entity for which the changes are tracked.
public override Type EntityType { get; }
Property Value
- Type
The actual type of the entity for which the changes are tracked.
ExpectedClrType
public override Type ExpectedClrType { get; }
Property Value
Methods
Clear()
Clears the Delta and resets the underlying Entity.
public override void Clear()
CopyChangedValues(TEntityType)
Copies the changed property values from the underlying entity (accessible via GetEntity() to the original
entity.
public void CopyChangedValues(TEntityType original)
Parameters
original
TEntityTypeThe entity to be updated.
CopyUnchangedValues(TEntityType)
Copies the unchanged property values from the underlying entity (accessible via GetEntity() ) to the original
entity.
public void CopyUnchangedValues(TEntityType original)
Parameters
original
TEntityTypeThe entity to be updated.
GetChangedPropertyNames()
Returns the Properties that have been modified through this Delta as an enumeration of property names.
public override IEnumerable<string> GetChangedPropertyNames()
Returns
- IEnumerable<string>
The property names.
GetDynamicMemberNames()
public override IEnumerable<string> GetDynamicMemberNames()
Returns
- IEnumerable<string>
Returns IEnumerable<T>.
GetEntity()
Returns the EntityType instance that holds all the changes (and original values) being tracked by this Delta.
public TEntityType GetEntity()
Returns
- TEntityType
The EntityType istance.
GetUnchangedPropertyNames()
Returns the properties that have not been modified through this Delta as an enumeration of property names.
public override IEnumerable<string> GetUnchangedPropertyNames()
Returns
- IEnumerable<string>
The properties that have not been modified through this Delta as an enumeration of property names.
Patch(TEntityType)
Overwrites the original
entity with the changes tracked by this Delta.
public void Patch(TEntityType original)
Parameters
original
TEntityTypeThe entity to be updated.
Put(TEntityType)
Overwrites the original
entity with the values stored in this Delta.
public void Put(TEntityType original)
Parameters
original
TEntityTypeThe entity to be updated.
TryGetPropertyType(string, out Type)
Attempts to get the Type of the property called name
from the underlying entity.
public override bool TryGetPropertyType(string name, out Type type)
Parameters
Returns
- bool
true if the property was found; otherwise, false.
TryGetPropertyValue(string, out object)
Attempts to get the value of the property called name
from the underlying entity.
public override bool TryGetPropertyValue(string name, out object value)
Parameters
Returns
- bool
true if the property was found.
TrySetPropertyValue(string, object)
Attempts to set the property called name
to the value
specified.
public override bool TrySetPropertyValue(string name, object value)
Parameters
Returns
- bool
true if successful; otherwise, false.