-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented Do method for the ChangesFrame to replace Update/Save/Loa…
…d methods
- Loading branch information
Showing
20 changed files
with
207 additions
and
257 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace CoreCraft.ChangesTracking; | ||
|
||
/// <summary> | ||
/// TODO: write documentation | ||
/// </summary> | ||
public interface IChangesFrameOperation | ||
{ | ||
/// <summary> | ||
/// </summary> | ||
/// <typeparam name="TEntity">A type of an entity</typeparam> | ||
/// <typeparam name="TProperties">A type of properties</typeparam> | ||
/// <param name="collection">A base collection which will be wrapped in this method</param> | ||
/// <returns>A new collection with adjusted behavior</returns> | ||
void OnCollection<TEntity, TProperties>( | ||
ICollectionChangeSet<TEntity, TProperties> collection) | ||
where TEntity : Entity | ||
where TProperties : Properties; | ||
|
||
/// <summary> | ||
/// </summary> | ||
/// <typeparam name="TParent">A type of a parent entity</typeparam> | ||
/// <typeparam name="TChild">A type of a child entity</typeparam> | ||
/// <param name="relation">A base relation which will be wrapped in this method</param> | ||
/// <returns>A new relation with adjusted behavior</returns> | ||
void OnRelation<TParent, TChild>( | ||
IRelationChangeSet<TParent, TChild> relation) | ||
where TParent : Entity | ||
where TChild : Entity; | ||
} |
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
33 changes: 33 additions & 0 deletions
33
src/CoreCraft/Persistence/Operations/LoadChangesFrameOperation.cs
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,33 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using CoreCraft.ChangesTracking; | ||
using CoreCraft.Persistence.History; | ||
|
||
namespace CoreCraft.Persistence.Operations; | ||
|
||
/// <summary> | ||
/// TODO: write documentation | ||
/// </summary> | ||
/// <param name="timestamp"></param> | ||
/// <param name="repository"></param> | ||
[ExcludeFromCodeCoverage] | ||
public readonly struct LoadChangesFrameOperation(long timestamp, IHistoryRepository repository) : IChangesFrameOperation | ||
{ | ||
private readonly long _timestamp = timestamp; | ||
private readonly IHistoryRepository _repository = repository; | ||
|
||
/// <inheritdoc /> | ||
public void OnCollection<TEntity, TProperties>(ICollectionChangeSet<TEntity, TProperties> collection) | ||
where TEntity : Entity | ||
where TProperties : Properties | ||
{ | ||
_repository.Load(_timestamp, collection); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public void OnRelation<TParent, TChild>(IRelationChangeSet<TParent, TChild> relation) | ||
where TParent : Entity | ||
where TChild : Entity | ||
{ | ||
_repository.Load(_timestamp, relation); | ||
} | ||
} |
Oops, something went wrong.