A small internal class that validates a command handler delegate signature with five generic parameters. It attempts to create a closed delegate from a MethodDescription, choosing between a synchronous Func returning CommandResult and an async Task<CommandResult> version to ensure the method can be bound without invoking it.
namespace SboxSuperuser.Engine.CommandDiscovery;
internal sealed class HandlerSignature5<T1, T2, T3, T4, T5> : 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, T5, CommandResult>>();
}
else
{
_ = method.CreateDelegate<Func<T1, T2, T3, T4, T5, Task<CommandResult>>>();
}
}
}