A small class that validates a discovered command handler delegate signature with one generic parameter T1. It ensures a method can be closed over to either Func<T1, CommandResult> or Func<T1, Task<CommandResult>> by creating the delegate without invoking it.
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>>>();
}
}
}