You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Framework/Connected.Services/ArgumentValueProvider.cs

33 lines
967 B

using Connected.Middleware;
namespace Connected.Services;
/// <summary>
/// Default implementation of the <see cref="IArgumentValueProvider{TArgs}"/> interface.
/// </summary>
/// <typeparam name="TArgs">The type of the arguments to provide values for.</typeparam>
public abstract class ArgumentValueProvider<TArgs> : MiddlewareComponent, IArgumentValueProvider<TArgs>
where TArgs : IDto
{
/// <summary>
/// The arguments object to which values are to be provided.
/// </summary>
protected TArgs Arguments { get; private set; } = default!;
/// <summary>
/// This method gets invoked by the platform.
/// </summary>
/// <param name="args">The arguments object to which the values can be provided.</param>
public async Task Invoke(TArgs args)
{
Arguments = args;
await OnInvoking();
}
/// <summary>
/// Override this method to perform business logic.
/// </summary>
protected virtual async Task OnInvoking()
{
await Task.CompletedTask;
}
}