-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
(GH-603) Added a new repository interception context object
- Loading branch information
Showing
6 changed files
with
113 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
33 changes: 33 additions & 0 deletions
33
src/DotNetToolkit.Repository/Configuration/Interceptors/RepositoryInterceptionContext.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 @@ | ||
namespace DotNetToolkit.Repository.Configuration.Interceptors | ||
{ | ||
using JetBrains.Annotations; | ||
using Utility; | ||
|
||
/// <summary> | ||
/// Represents contextual information associated with calls into <see cref="IRepositoryInterceptor" />. | ||
/// </summary> | ||
/// <typeparam name="TEntity">The type of the entity associated to the current operation.</typeparam> | ||
public class RepositoryInterceptionContext<TEntity> where TEntity : class | ||
{ | ||
/// <summary> | ||
/// Gets the entity associated with the current operation. | ||
/// </summary> | ||
public TEntity Entity { get; } | ||
|
||
/// <summary> | ||
/// Gets the context. | ||
/// </summary> | ||
public IRepositoryContext Context { get; } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="RepositoryInterceptionContext{TEntity}"/> class. | ||
/// </summary> | ||
/// <param name="entity">The entity.</param> | ||
/// <param name="context">The context.</param> | ||
public RepositoryInterceptionContext([NotNull] TEntity entity, [NotNull] IRepositoryContext context) | ||
{ | ||
Entity = Guard.NotNull(entity, nameof(entity)); | ||
Context = Guard.NotNull(context, nameof(context)); | ||
} | ||
} | ||
} |
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.