-
Notifications
You must be signed in to change notification settings - Fork 5
/
IOnPersistBehavior.cs
47 lines (43 loc) · 2.07 KB
/
IOnPersistBehavior.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IOnPersistBehavior.cs" company="Kephas Software SRL">
// Copyright (c) Kephas Software SRL. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
// <summary>
// Declares the IOnPersistBehavior interface.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Kephas.Data.Behaviors
{
using System.Threading;
using System.Threading.Tasks;
using Kephas.Data.Capabilities;
/// <summary>
/// Contract for the behavior invoked upon persist operation.
/// </summary>
public interface IOnPersistBehavior
{
/// <summary>
/// Callback invoked before an entity is being persisted.
/// </summary>
/// <param name="entity">The entity to be persisted.</param>
/// <param name="entityEntry">The entity entry.</param>
/// <param name="operationContext">The operation context.</param>
/// <param name="cancellationToken">Optional. The cancellation token.</param>
/// <returns>
/// A Task.
/// </returns>
Task BeforePersistAsync(object entity, IEntityEntry entityEntry, IDataOperationContext operationContext, CancellationToken cancellationToken = default);
/// <summary>
/// Callback invoked after an entity was persisted.
/// </summary>
/// <param name="entity">The entity to be persisted.</param>
/// <param name="entityEntry">The entity entry.</param>
/// <param name="operationContext">The operation context.</param>
/// <param name="cancellationToken">Optional. The cancellation token.</param>
/// <returns>
/// A Task.
/// </returns>
Task AfterPersistAsync(object entity, IEntityEntry entityEntry, IDataOperationContext operationContext, CancellationToken cancellationToken = default);
}
}