public IFlowBuilder To <TBlockTarget>() where TBlockTarget : BlockBase { if (this._sourceIds == null || !this._sourceIds.Any()) { throw new InvalidOperationException("Source block not set. Use Link() method before To()"); } var targetBlock = this.GetBlock(this.CreateDefaultBlockWithId <TBlockTarget>()); if (targetBlock == null) { throw new InvalidOperationException($"Target block with of type {typeof(TBlockTarget).Name} not found"); } foreach (var source in this._sourceIds) { var sourceBlock = this.GetBlock(source); if (sourceBlock == null) { throw new InvalidOperationException($"target block with id {source} not found"); } this._recentLinks.Push(BlockLink.Link(sourceBlock, targetBlock)); } return(this); }
public IFlowBuilder To(string targetId) { this.ValidateInExisting(targetId); if (this._sourceIds == null || !this._sourceIds.Any()) { throw new InvalidOperationException("Source block not set. Use Link() method before To()"); } var targetBlock = this.GetBlock(targetId); foreach (var source in this._sourceIds) { var sourceBlock = this.GetBlock(source); if (sourceBlock == null) { throw new InvalidOperationException($"target block with id {source} not found"); } this._recentLinks.Push(BlockLink.Link(sourceBlock, targetBlock)); } return(this); }