Beispiel #1
0
 private void Replace(int index, MdxParameter newValue)
 {
     Validate(index, newValue);
     ((MdxParameter)_items[index]).Parent = null;
     newValue.Parent = this;
     _items[index]   = newValue;
 }
Beispiel #2
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);
 }
Beispiel #3
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");
        }
Beispiel #4
0
        protected override DbParameter GetParameter(string parameterName)
        {
            MdxParameter mdxParameter = Find(parameterName);

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

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