Class DataBehaviorBase<TEntity>
An entity behavior base.
Inheritance
Implements
Inherited Members
Namespace: Kephas.Data.Behaviors
Assembly: Kephas.Data.dll
Syntax
public abstract class DataBehaviorBase<TEntity> : Loggable, ILoggable, IDataBehavior<TEntity>, IDataBehavior, IOnPersistBehavior, IOnInitializeBehavior, IOnValidateBehavior
Type Parameters
Name | Description |
---|---|
TEntity | Type of the entity. |
Methods
| Improve this Doc View SourceAfterPersist(TEntity, IEntityEntry, IDataOperationContext)
Callback invoked after an entity has been persisted.
Declaration
public virtual void AfterPersist(TEntity entity, IEntityEntry entityEntry, IDataOperationContext operationContext)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | The entity to be persisted. |
IEntityEntry | entityEntry | The entity entry. |
IDataOperationContext | operationContext | The operation context. |
AfterPersistAsync(TEntity, IEntityEntry, IDataOperationContext, CancellationToken)
Callback invoked after an entity was persisted.
Declaration
public virtual Task AfterPersistAsync(TEntity entity, IEntityEntry entityEntry, IDataOperationContext operationContext, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | The entity to be persisted. |
IEntityEntry | entityEntry | The entity entry. |
IDataOperationContext | operationContext | The operation context. |
System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A Task. |
BeforePersist(TEntity, IEntityEntry, IDataOperationContext)
Callback invoked before an entity is being persisted.
Declaration
public virtual void BeforePersist(TEntity entity, IEntityEntry entityEntry, IDataOperationContext operationContext)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | The entity to be persisted. |
IEntityEntry | entityEntry | The entity entry. |
IDataOperationContext | operationContext | The operation context. |
BeforePersistAsync(TEntity, IEntityEntry, IDataOperationContext, CancellationToken)
Callback invoked before an entity is being persisted.
Declaration
public virtual Task BeforePersistAsync(TEntity entity, IEntityEntry entityEntry, IDataOperationContext operationContext, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | The entity to be persisted. |
IEntityEntry | entityEntry | The entity entry. |
IDataOperationContext | operationContext | The operation context. |
System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A Task. |
Initialize(TEntity, IEntityEntry, IDataOperationContext)
Callback invoked upon entity initialization.
Declaration
public virtual void Initialize(TEntity entity, IEntityEntry entityEntry, IDataOperationContext operationContext)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | The entitiy to be initialized. |
IEntityEntry | entityEntry | The entity entry. |
IDataOperationContext | operationContext | The operation context. |
InitializeAsync(TEntity, IEntityEntry, IDataOperationContext, CancellationToken)
Initializes the entity asynchronously.
Declaration
public virtual Task InitializeAsync(TEntity entity, IEntityEntry entityEntry, IDataOperationContext operationContext, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | The entitiy to be initialized. |
IEntityEntry | entityEntry | The entity entry. |
IDataOperationContext | operationContext | The operation context. |
System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A Task. |
Validate(TEntity, IEntityEntry, IDataOperationContext)
Callback invoked after upon entity validation.
Declaration
public virtual IDataValidationResult Validate(TEntity entity, IEntityEntry entityEntry, IDataOperationContext operationContext)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | The entity. |
IEntityEntry | entityEntry | The entity entry. |
IDataOperationContext | operationContext | The operation context. |
Returns
Type | Description |
---|---|
IDataValidationResult |
ValidateAsync(TEntity, IEntityEntry, IDataOperationContext, CancellationToken)
Validates the provided instance asynchronously.
Declaration
public virtual Task<IDataValidationResult> ValidateAsync(TEntity entity, IEntityEntry entityEntry, IDataOperationContext operationContext, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | The entity to be validated. |
IEntityEntry | entityEntry | The entity entry. |
IDataOperationContext | operationContext | Context for the validation operation. |
System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IDataValidationResult> | A promise of a IDataValidationResult. |
Explicit Interface Implementations
| Improve this Doc View SourceIOnInitializeBehavior.InitializeAsync(Object, IEntityEntry, IDataOperationContext, CancellationToken)
Initializes the entity asynchronously.
Declaration
Task IOnInitializeBehavior.InitializeAsync(object entity, IEntityEntry entityEntry, IDataOperationContext operationContext, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Object | entity | The entitiy to be initialized. |
IEntityEntry | entityEntry | The entity entry. |
IDataOperationContext | operationContext | The operation context. |
System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A Task. |
IOnPersistBehavior.AfterPersistAsync(Object, IEntityEntry, IDataOperationContext, CancellationToken)
Callback invoked after an entity was persisted.
Declaration
Task IOnPersistBehavior.AfterPersistAsync(object entity, IEntityEntry entityEntry, IDataOperationContext operationContext, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Object | entity | The entity to be persisted. |
IEntityEntry | entityEntry | The entity entry. |
IDataOperationContext | operationContext | The operation context. |
System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A Task. |
IOnPersistBehavior.BeforePersistAsync(Object, IEntityEntry, IDataOperationContext, CancellationToken)
Callback invoked before an entity is being persisted.
Declaration
Task IOnPersistBehavior.BeforePersistAsync(object entity, IEntityEntry entityEntry, IDataOperationContext operationContext, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Object | entity | The entity to be persisted. |
IEntityEntry | entityEntry | The entity entry. |
IDataOperationContext | operationContext | The operation context. |
System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A Task. |
IOnValidateBehavior.ValidateAsync(Object, IEntityEntry, IDataOperationContext, CancellationToken)
Validates the provided instance asynchronously.
Declaration
Task<IDataValidationResult> IOnValidateBehavior.ValidateAsync(object entity, IEntityEntry entityEntry, IDataOperationContext operationContext, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Object | entity | The entity to be validated. |
IEntityEntry | entityEntry | The entity entry. |
IDataOperationContext | operationContext | Context for the validation operation. |
System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IDataValidationResult> | A promise of a IDataValidationResult. |