Represents a parameter to an MdxCommand
상속: System.Data.Common.DbParameter, ICloneable
예제 #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);
 }
예제 #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;
 }
예제 #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");
        }
예제 #5
0
        protected override DbParameter GetParameter(string parameterName)
        {
            MdxParameter mdxParameter = Find(parameterName);

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

            return(mdxParameter);
        }
예제 #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);
 }
예제 #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));
 }
예제 #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));
 }
예제 #17
0
 public void Insert(int index, MdxParameter value)
 {
     Validate(-1, value);
     value.Parent = this;
     _items.Insert(index, value);
 }