Class EntityEntry
Provides extended information about the entity.
Inheritance
Implements
Inherited Members
Namespace: Kephas.Data.Capabilities
Assembly: Kephas.Data.dll
Syntax
public class EntityEntry : Expando, IEntityEntry, IExpando, IDynamicMetaObjectProvider, IIndexable, IChangeStateTrackableEntityEntry, IChangeStateTrackable, IIdentifiable, IAggregatable, IDisposable
Constructors
| Improve this Doc View SourceEntityEntry(Object)
Initializes a new instance of the EntityEntry class.
Declaration
public EntityEntry(object entity)
Parameters
Type | Name | Description |
---|---|---|
System.Object | entity | The entity. |
Properties
| Improve this Doc View SourceChangeState
Gets or sets the change state of the entity.
Declaration
public ChangeState ChangeState { get; set; }
Property Value
Type | Description |
---|---|
ChangeState | The change state. |
DataContext
Gets or sets the entity owning data context.
Declaration
public IDataContext DataContext { get; set; }
Property Value
Type | Description |
---|---|
IDataContext | The data context. |
Entity
Gets the entity.
Declaration
public object Entity { get; }
Property Value
Type | Description |
---|---|
System.Object | The entity. |
EntityId
Gets the identifier of the entity.
Declaration
public object EntityId { get; }
Property Value
Type | Description |
---|---|
System.Object | The identifier of the entity. |
ExpandoEntity
Gets a wrapper expando object over the entity, to access dynamic values from it.
Declaration
protected IExpando ExpandoEntity { get; }
Property Value
Type | Description |
---|---|
IExpando |
Id
Gets or sets the identifier for this instance.
Declaration
public object Id { get; protected set; }
Property Value
Type | Description |
---|---|
System.Object | The identifier. |
OriginalEntity
Gets a copy of the original entity, before any changes occurred.
Declaration
public IExpando OriginalEntity { get; }
Property Value
Type | Description |
---|---|
IExpando | The original entity. |
PrePersistChangeState
Gets or sets the change state of the entity before persisting to the data store.
Declaration
public ChangeState PrePersistChangeState { get; set; }
Property Value
Type | Description |
---|---|
ChangeState | The change state. |
Remarks
This value is typically used in the post processing part of the persist behavior (AfterPersistAsync(Object, IEntityEntry, IDataOperationContext, CancellationToken)) to perform specific tasks depending on the value of ChangeState before persisting to the data store. Outside this behavior this value is not reliable, as the behaviors may trigger multiple persist commands for an entity and this state is typically the value before the last persist command.
Methods
| Improve this Doc View SourceAcceptChanges()
Accepts the changes and resets the change state to NotChanged.
Declaration
public virtual void AcceptChanges()
AttachPropertyChangeHandlers()
Attaches the property change handlers.
Declaration
protected virtual void AttachPropertyChangeHandlers()
CreateOriginalEntity()
Creates the original entity as a stamp of the current entity.
Declaration
protected virtual IExpando CreateOriginalEntity()
Returns
Type | Description |
---|---|
IExpando | The new original entity. |
DetachPropertyChangeHandlers()
Detaches the property change handlers.
Declaration
protected virtual void DetachPropertyChangeHandlers()
DiscardChanges()
Discards the changes and resets the change state to NotChanged.
Declaration
public virtual void DiscardChanges()
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(Boolean)
Releases the unmanaged resources used by the EntityEntry and optionally releases the managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | True to release both managed and unmanaged resources; false to release only unmanaged resources. |
GetFlattenedEntityGraphAsync(IGraphOperationContext, CancellationToken)
Gets the flattened entity graph asynchronously. This may include also loose parts which are asynchronously loaded. If no loose parts must be loaded, then the result is the same with GetStructuralEntityGraph()
Declaration
public Task<IEnumerable<object>> GetFlattenedEntityGraphAsync(IGraphOperationContext operationContext, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IGraphOperationContext | operationContext | The operation context. |
System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<System.Object>> | A promise of the flattened entity graph. |
GetGraphRoot()
Gets the root of the entity graph.
Declaration
public IAggregatable GetGraphRoot()
Returns
Type | Description |
---|---|
IAggregatable | The graph root. |
GetStructuralEntityGraph()
Gets the flattened structural entity graph excluding the loose parts (only the internal structure).
Declaration
public IEnumerable<object> GetStructuralEntityGraph()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Object> | The flattened structural entity graph. |
IsChanged(String)
Gets a value indicating whether the provided property changed.
Declaration
public virtual bool IsChanged(string property)
Parameters
Type | Name | Description |
---|---|---|
System.String | property | The property name. |
Returns
Type | Description |
---|---|
System.Boolean | True if the property changed, false if not. |
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string that represents the current object. |
Overrides
TryGetChangeStateTracker()
Gets the change state tracker.
Declaration
protected virtual IChangeStateTrackable TryGetChangeStateTracker()
Returns
Type | Description |
---|---|
IChangeStateTrackable | The change state tracker. |
TryGetEntityGraph()
Gets the entity graph.
Declaration
protected virtual IAggregatable TryGetEntityGraph()
Returns
Type | Description |
---|---|
IAggregatable | The entity graph. |
TryGetEntityId()
Gets the entity identifier.
Declaration
protected virtual object TryGetEntityId()
Returns
Type | Description |
---|---|
System.Object | The entity identifier. |
TryGetNotifyPropertyChanged()
Gets the System.ComponentModel.INotifyPropertyChanged capability.
Declaration
protected virtual INotifyPropertyChanged TryGetNotifyPropertyChanged()
Returns
Type | Description |
---|---|
System.ComponentModel.INotifyPropertyChanged | An object implementing INotifyPropertyChanged, or |
TryGetNotifyPropertyChanging()
Gets the System.ComponentModel.INotifyPropertyChanging capability.
Declaration
protected virtual INotifyPropertyChanging TryGetNotifyPropertyChanging()
Returns
Type | Description |
---|---|
System.ComponentModel.INotifyPropertyChanging | An object implementing INotifyPropertyChanging, or |