-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improving the support for idempotency behavior, providing repositorie…
…s that track changes of the returned entities
- Loading branch information
Showing
20 changed files
with
565 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Deveel.Data { | ||
/// <summary> | ||
/// Defines a repository that is able to track changes | ||
/// on entities returned by queries. | ||
/// </summary> | ||
/// <typeparam name="TEntity"> | ||
/// The type of entity managed by the repository. | ||
/// </typeparam> | ||
public interface ITrackingRepository<TEntity> : ITrackingRepository<TEntity, object> | ||
where TEntity : class { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
namespace Deveel.Data { | ||
/// <summary> | ||
/// Defines a repository that is able to track changes | ||
/// on entities returned by queries. | ||
/// </summary> | ||
/// <typeparam name="TEntity"> | ||
/// The type of entity managed by the repository. | ||
/// </typeparam> | ||
/// <typeparam name="TKey"> | ||
/// The type of the key used to identify the entity. | ||
/// </typeparam> | ||
public interface ITrackingRepository<TEntity, TKey> : IRepository<TEntity, TKey> | ||
where TEntity : class { | ||
/// <summary> | ||
/// Gets a value indicating if the repository is tracking | ||
/// changes on entities. | ||
/// </summary> | ||
/// <remarks> | ||
/// A repository implementation of this contract might | ||
/// be configured not to track changes on entities, in | ||
/// this case the value of this property is <c>false</c>. | ||
/// </remarks> | ||
bool IsTrackingChanges { get; } | ||
|
||
/// <summary> | ||
/// Finds the original entity that is being tracked by the repository, | ||
/// as it was loaded from the data source. | ||
/// </summary> | ||
/// <param name="key"> | ||
/// The key that identifies the entity. | ||
/// </param> | ||
/// <param name="cancellationToken"> | ||
/// A cancellation token that can be used to cancel the operation. | ||
/// </param> | ||
/// <returns> | ||
/// Returns the original version of entity that is being tracked by the repository, | ||
/// as it was loaded from the data source, or <c>null</c> if the entity is not | ||
/// found or it's not being tracked. | ||
/// </returns> | ||
Task<TEntity?> FindOriginalAsync(TKey key, CancellationToken cancellationToken = default); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.