Beispiel #1
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="cmd">The command this instance will be associated with.</param>
        public ScalarExecutor(Core.IScalarCommand 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));
            }
        }
Beispiel #2
0
        /// <summary>
        /// Factory method invoked to create an executor to execute the given scalar command.
        /// </summary>
        /// <param name="command">The command to execute.</param>
        /// <returns>An executor able to execute de command.</returns>
        public IScalarExecutor CreateScalarExecutor(Core.IScalarCommand 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 ScalarExecutor(command));
        }
Beispiel #3
0
 Core.IScalarExecutor Core.IDataLink.CreateScalarExecutor(Core.IScalarCommand command)
 {
     return(this.CreateScalarExecutor(command));
 }