2026-04-07 14:23:29 +02:00
|
|
|
namespace Finch.Raven;
|
2022-12-07 14:05:11 +01:00
|
|
|
|
|
|
|
|
public class InterceptorParameters
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2026-04-07 14:23:29 +02:00
|
|
|
/// The current finch context
|
2022-12-07 14:05:11 +01:00
|
|
|
/// </summary>
|
2026-04-07 14:23:29 +02:00
|
|
|
public IFinchContext Context { get; set; }
|
2022-12-07 14:05:11 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Raven document store
|
|
|
|
|
/// </summary>
|
2026-04-07 14:23:29 +02:00
|
|
|
public IFinchStore Store { get; set; }
|
2022-12-07 14:05:11 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Access to other interceptor methods
|
|
|
|
|
/// </summary>
|
|
|
|
|
public IInterceptors Interceptors { get; internal set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Access to operations
|
|
|
|
|
/// </summary>
|
2022-12-07 14:29:07 +01:00
|
|
|
public IRavenOperations Operations { get; internal set; }
|
2022-12-07 14:05:11 +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);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Holds a reference to the previously existing model when an update happens (can be null)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public object PreviousModel { get; set; }
|
|
|
|
|
}
|