Represents a parameter to an MdxCommand
Inheritance: System.Data.Common.DbParameter, ICloneable
Exemplo n.º 1
0
 /// <summary>
 /// Adds an MdxParameter object to the MdxParameterCollection collection.
 /// </summary>
 /// <param name="value">The MdxParameter object to be added.</param>
 public MdxParameter Add(MdxParameter value)
 {
     Validate(-1, value);
     value.Parent = this;
     _items.Add(value);
     return(value);
 }
Exemplo n.º 2
0
 private void Replace(int index, MdxParameter newValue)
 {
     Validate(index, newValue);
     ((MdxParameter)_items[index]).Parent = null;
     newValue.Parent = this;
     _items[index]   = newValue;
 }
 /// <summary>
 /// Adds an MdxParameter object to the MdxParameterCollection collection.
 /// </summary>
 /// <param name="value">The MdxParameter object to be added.</param>
 public MdxParameter Add(MdxParameter value)
 {
     Validate(-1, value);
     value.Parent = this;
     _items.Add(value);
     return value;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Removes the specified MdxParameter object from the collection.
        /// </summary>
        /// <param name="value">The MdxParameter object to remove.</param>
        public void Remove(MdxParameter value)
        {
            int num = IndexOf(value);

            if (-1 != num)
            {
                RemoveIndex(num);
                return;
            }
            throw new ArgumentException("Property does not exist", "value");
        }
Exemplo n.º 5
0
        protected override DbParameter GetParameter(string parameterName)
        {
            MdxParameter mdxParameter = Find(parameterName);

            if (mdxParameter == null)
            {
                throw new ArgumentException(parameterName, "parameterName");
            }

            return(mdxParameter);
        }
Exemplo n.º 6
0
        internal void Validate(int index, MdxParameter value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            if (value.Parent != null)
            {
                if (this != value.Parent)
                {
                    throw new ArgumentException("mismatch", "value");
                }
                if (index != IndexOf(value.ParameterName))
                {
                    throw new ArgumentException("already exists", "value");
                }
            }
            string text = value.ParameterName;

            if (text.Length == 0)
            {
                index = 1;
                int num = 0;
                while (index < 2147483647 && num != -1)
                {
                    text = "Parameter" + index.ToString(CultureInfo.InvariantCulture);
                    num  = IndexOf(text);
                    index++;
                }
                if (-1 != num)
                {
                    text = "Parameter" + Guid.NewGuid().ToString();
                }
                value.ParameterName = text;
            }
        }
 /// <summary>
 /// Adds an array of items with the specified values to the MdxParameterCollection.
 /// </summary>
 /// <param name="values">An array of values of type MdxParameter to add to the collection.</param>
 public void AddRange(MdxParameter[] values)
 {
     if (null != values)
     {
         _items.AddRange(values);
     }
 }
 private void Replace(int index, MdxParameter newValue)
 {
     Validate(index, newValue);
     ((MdxParameter)_items[index]).Parent = null;
     newValue.Parent = this;
     _items[index] = newValue;
 }
 internal void Validate(int index, MdxParameter value)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     if (value.Parent != null)
     {
         if (this != value.Parent)
         {
             throw new ArgumentException("mismatch", "value");
         }
         if (index != IndexOf(value.ParameterName))
         {
             throw new ArgumentException("already exists", "value");
         }
     }
     string text = value.ParameterName;
     if (text.Length == 0)
     {
         index = 1;
         int num = 0;
         while (index < 2147483647 && num != -1)
         {
             text = "Parameter" + index.ToString(CultureInfo.InvariantCulture);
             num = IndexOf(text);
             index++;
         }
         if (-1 != num)
         {
             text = "Parameter" + Guid.NewGuid().ToString();
         }
         value.ParameterName = text;
     }
 }
 /// <summary>
 /// Removes the specified MdxParameter object from the collection.
 /// </summary>
 /// <param name="value">The MdxParameter object to remove.</param>
 public void Remove(MdxParameter value)
 {
     int num = IndexOf(value);
     if (-1 != num)
     {
         RemoveIndex(num);
         return;
     }
     throw new ArgumentException("Property does not exist", "value");
 }
 public void Insert(int index, MdxParameter value)
 {
     Validate(-1, value);
     value.Parent = this;
     _items.Insert(index, value);
 }
 /// <summary>
 /// Returns the index of the specified MdxParameter object.
 /// </summary>
 /// <param name="value">The MdxParameter object in the collection.</param>
 public int IndexOf(MdxParameter value)
 {
     return _items.IndexOf(value);
 }
 /// <summary>
 /// Copies an array of items to the collection starting at the specified index.
 /// </summary>
 /// <param name="array">The array of items to copy to the collection.</param>
 /// <param name="index">The index in the collection to copy the items.</param>
 public void CopyTo(MdxParameter[] array, int index)
 {
     _items.CopyTo(array, index);
 }
 /// <summary>
 /// Indicates whether an MdxParameter with the specified property exists in the collection.
 /// </summary>
 /// <param name="value">The value of the MdxParameter to look for in the collection.</param>
 public bool Contains(MdxParameter value)
 {
     return -1 != IndexOf(value);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Returns the index of the specified MdxParameter object.
 /// </summary>
 /// <param name="value">The MdxParameter object in the collection.</param>
 public int IndexOf(MdxParameter value)
 {
     return(_items.IndexOf(value));
 }
Exemplo n.º 16
0
 /// <summary>
 /// Indicates whether an MdxParameter with the specified property exists in the collection.
 /// </summary>
 /// <param name="value">The value of the MdxParameter to look for in the collection.</param>
 public bool Contains(MdxParameter value)
 {
     return(-1 != IndexOf(value));
 }
Exemplo n.º 17
0
 public void Insert(int index, MdxParameter value)
 {
     Validate(-1, value);
     value.Parent = this;
     _items.Insert(index, value);
 }