Init
This commit is contained in:
15
Prefab/Handler/HandlerBase.cs
Normal file
15
Prefab/Handler/HandlerBase.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Prefab.Handler.Decorators;
|
||||
|
||||
namespace Prefab.Handler;
|
||||
|
||||
/// <summary>
|
||||
/// Provides a base class for handler implementations that require access to the current handler context.
|
||||
/// </summary>
|
||||
/// <param name="accessor">The accessor used to retrieve the current handler context. Cannot be null.</param>
|
||||
public abstract class HandlerBase(IHandlerContextAccessor accessor)
|
||||
{
|
||||
protected IHandlerContextAccessor Accessor { get; } = accessor;
|
||||
|
||||
protected HandlerContext Context => Accessor.Current ??
|
||||
throw new InvalidOperationException($"HandlerContext not set ({nameof(HandlerContextDecorator)}) must run first).");
|
||||
}
|
||||
Reference in New Issue
Block a user