public static void AddAsyncEditHandler <TSourceData, TTargetData>( this PowerTablesHandler <TSourceData, TTargetData> handler, Func <PowerTablesData <TSourceData, TTargetData>, EditionResultWrapper <TTargetData>, Task> method) where TTargetData : new() { var del = new EditorCommandHandler <TSourceData, TTargetData>(method); handler.RegisterCommandHandler(EditorExtensions.EditCommand, del); }
/// <summary> /// Registers asynchronous delegate command handler /// </summary> /// <typeparam name="TSourceData"></typeparam> /// <typeparam name="TTargetData"></typeparam> /// <typeparam name="TResponse"></typeparam> /// <param name="handler">Request handler</param> /// <param name="command">String command identifier</param> /// <param name="asyncMethod">Asynchronous method implementing command</param> /// <param name="syncmethod">Method implementing command</param> /// <param name="forceDeferred">Should this command be deferred (query cached for further results retrieving)</param> public static void AddCommandHandler <TSourceData, TTargetData, TResponse>( this PowerTablesHandler <TSourceData, TTargetData> handler, string command, Func <PowerTablesData <TSourceData, TTargetData>, Task <TResponse> > asyncMethod, Func <PowerTablesData <TSourceData, TTargetData>, TResponse> syncmethod, bool forceDeferred = false) where TTargetData : new() { var del = new DelegateCommandHandler <TSourceData, TTargetData, TResponse>(syncmethod, asyncMethod); handler.RegisterCommandHandler(command, del); }