Validation helper for command handlers taking three arguments. Checks that the method binds to either a Func<T1,T2,T3,CommandResult> or a Func<T1,T2,T3,Task<CommandResult>> delegate via MethodDescription.CreateDelegate, throwing if the signature does not match.
namespace SboxSuperuser.Engine.CommandDiscovery;
internal sealed class HandlerSignature3<T1, T2, T3> : 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, CommandResult>>();
}
else
{
_ = method.CreateDelegate<Func<T1, T2, T3, Task<CommandResult>>>();
}
}
}