A generic handler signature validator for command methods that take four parameters. It checks that a given Sandbox.MethodDescription can create a closed delegate matching either Func<T1,T2,T3,T4,CommandResult> or Func<T1,T2,T3,T4,Task<CommandResult>> without invoking the method.
namespace SboxSuperuser.Engine.CommandDiscovery;
internal sealed class HandlerSignature4<T1, T2, T3, T4> : 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, T2, T3, T4, CommandResult>>();
}
else
{
_ = method.CreateDelegate<Func<T1, T2, T3, T4, Task<CommandResult>>>();
}
}
}