2021-11-20 13:52:28 +01:00
|
|
|
namespace zero.Communication;
|
2021-11-19 12:03:36 +01:00
|
|
|
|
2021-11-18 16:00:20 +01:00
|
|
|
public class InterceptorParameters
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The current zero context
|
|
|
|
|
/// </summary>
|
|
|
|
|
public IZeroContext Context { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Raven document store
|
|
|
|
|
/// </summary>
|
|
|
|
|
public IZeroStore Store { get; set; }
|
|
|
|
|
|
2021-11-27 18:09:27 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Access to other interceptor methods
|
|
|
|
|
/// </summary>
|
|
|
|
|
public IInterceptors Interceptors { get; internal set; }
|
|
|
|
|
|
2021-12-28 13:23:14 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Access to operations
|
|
|
|
|
/// </summary>
|
|
|
|
|
public IStoreOperations Operations { get; internal set; }
|
|
|
|
|
|
2021-11-18 16:00:20 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Parameters from the interceptor which ran on before the operation (only available for completed operations)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Dictionary<string, object> Properties { get; set; } = new();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get a typed property
|
|
|
|
|
/// </summary>
|
|
|
|
|
public TProp Property<TProp>(string key) => Properties.GetValueOrDefault<TProp>(key);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get a typed property
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool TryGetProperty<TProp>(string key, out TProp property) => Properties.TryGetValue(key, out property);
|
|
|
|
|
}
|