A small internal class that validates a command handler delegate signature with one parameter. It attempts to create a closed delegate for the MethodDescription to ensure the method can be bound either as Func<T1, CommandResult> or Func<T1, Task<CommandResult>> depending on the method return type.
namespace SboxSuperuser.Engine.CommandDiscovery;
internal sealed class HandlerSignature1<T1> : IHandlerSignature
{
/// <summary>Checks closed delegate binding without executing the handler.</summary>
public void Validate( Sandbox.MethodDescription method )
{
if ( method.ReturnType == typeof( CommandResult ) )
{
_ = method.CreateDelegate<Func<T1, CommandResult>>();
}
else
{
_ = method.CreateDelegate<Func<T1, Task<CommandResult>>>();
}
}
}