/// <summary> /// Executes a request through it's generic types asynchronously /// </summary> /// <param name="arg"></param> /// <param name="key">The spatial affinity key to be used to direct this request to the node owning the partition it maps to</param> /// <returns></returns> public virtual Task <TResponse> ExecuteAsync(TArgument arg, ISubGridSpatialAffinityKey key) { if (key == null) { throw new TRexException("Affinity based result execution requires an affinity key"); } // Construct the function to be used var func = new TComputeFunc { Argument = arg }; // Send the result to the affinity bound node compute pool return(Compute != null?Compute.AffinityCallAsync(TRexCaches.SpatialSubGridDirectoryCacheName(StorageMutability.Immutable), key, func) : Task.FromResult <TResponse>(null)); }