/// <summary> /// Initializes a new instance. /// </summary> /// <param name="cmd">The command this instance will be associated with.</param> public EnumerableExecutor(Core.IEnumerableCommand cmd) : base(cmd) { var link = base.Link as IDataLink; if (link == null) { throw new InvalidOperationException( "Link '{0}' of command '{1}' is not a direct link.".FormatWith(base.Link, cmd)); } }
/// <summary> /// Factory method invoked to create an enumerator to execute the given enumerable /// command. /// </summary> /// <param name="command">The command to execute.</param> /// <returns>An enumerator able to execute de command.</returns> public IEnumerableExecutor CreateEnumerableExecutor(Core.IEnumerableCommand command) { if (command == null) { throw new ArgumentNullException("command", "Command cannot be null."); } if (command.IsDisposed) { throw new ObjectDisposedException(command.ToString()); } if (!object.ReferenceEquals(this, command.Link)) { throw new InvalidOperationException( "This link '{0}' is not the same as the link of command '{1}'." .FormatWith(this, command)); } return(new EnumerableExecutor(command)); }
Core.IEnumerableExecutor Core.IDataLink.CreateEnumerableExecutor(Core.IEnumerableCommand command) { return(this.CreateEnumerableExecutor(command)); }