public LinkCandidateInformation(
     DataflowVisitor visitor,
     ISourceHook <T> source,
     ITargetHook <T> target,
     DataflowLinkOptions options = null,
     Predicate <T> predicate     = null)
     : this(visitor, source, target,
            new LinkConnector(source.BlockInfo, target.BlockInfo),
            options, predicate)
 {
 }
Esempio n. 2
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 public void Dispose()
 {
     try
     {
         _disposal.Dispose();
         _source = null;
         _target = null;
         _visitor.RemoveLink(LinkInfo);
     }
     catch (Exception ex)
     {
         Trace.TraceError(ex.ToString());
     }
 }
        public LinkCandidateInformation(
            DataflowVisitor visitor,
            ISourceHook <T> source,
            ITargetHook <T> target,
            LinkConnector connector,
            DataflowLinkOptions options = null,
            Predicate <T> predicate     = null)
        {
            _visitor   = visitor;
            _source    = source;
            _target    = target;
            _predicate = predicate;

            if (options == null)
            {
                options = new DataflowLinkOptions();
            }
            Append              = options.Append;
            MaxMessages         = options.MaxMessages;
            PropagateCompletion = options.PropagateCompletion;

            Connector = connector;
        }
Esempio n. 4
0
        public LinkHook(
            ISourceHook <T> source,
            ITargetBlock <T> target,
            DataflowLinkOptions linkOptions,
            DataflowVisitor visitor,
            Predicate <T> predicate = null,
            LinkCandidateInformation <T> candidate = null)
        {
            _target = target;
            var targetHook = target as ITargetHook <T>;

            if (targetHook != null)
            {
                _targetName = targetHook.BlockInfo.Name;
                _targetInfo = targetHook.BlockInfo;
            }
            _source = source;

            _candidate = candidate;
            if (candidate != null)
            {
                LinkInfo = new LinkToInformation(candidate.Connector, linkOptions, UnLink);
            }

            if (predicate == null)
            {
                _disposal = _source.InternalSource.LinkTo(this, linkOptions);
            }
            else
            {
                _disposal = DataflowBlock.LinkTo(_source.InternalSource, this, linkOptions, predicate);
            }


            _visitor = visitor;
        }