/// <summary> /// It is anticipated that jobHandler is an injected /// singleton instance of a Dataflow based 'calculator', though this implementation /// does not depend on it being a singleton. /// </summary> /// <param name="jobHandler">A singleton Dataflow block through which all jobs are processed.</param> public DataflowJobManager(IPropagatorBlock <KeyValuePair <Guid, TInput>, KeyValuePair <Guid, TOutput> > jobHandler) { if (jobHandler == null) { throw new ArgumentException("Argument cannot be null.", "jobHandler"); } this.JobHandler = JobHandler; if (!alreadyLinked) { JobHandler.LinkTo(ResultHandler, new DataflowLinkOptions() { PropagateCompletion = true }); alreadyLinked = true; } }