예제 #1
0
 /// <summary>
 /// Inserts an <see cref="T:System.Object" /> into the
 /// <see cref="T:System.Data.Entity.Core.EntityClient.EntityParameterCollection" />
 /// at the specified index.
 /// </summary>
 /// <param name="index">The zero-based index at which value should be inserted.</param>
 /// <param name="value">
 /// An <see cref="T:System.Object" /> to be inserted in the
 /// <see cref="T:System.Data.Entity.Core.EntityClient.EntityParameterCollection" />
 /// .
 /// </param>
 public override void Insert(int index, object value)
 {
     this.OnChange();
     Check.NotNull <object>(value, nameof(value));
     EntityParameterCollection.ValidateType(value);
     this.Validate(-1, value);
     this.InnerList.Insert(index, (EntityParameter)value);
 }
예제 #2
0
 public override int Add(object value)
 {
     this.OnChange();
     Check.NotNull <object>(value, nameof(value));
     EntityParameterCollection.ValidateType(value);
     this.Validate(-1, value);
     this.InnerList.Add((EntityParameter)value);
     return(this.Count - 1);
 }
예제 #3
0
        private void Replace(int index, object newValue)
        {
            List <EntityParameter> innerList = this.InnerList;

            EntityParameterCollection.ValidateType(newValue);
            this.Validate(index, newValue);
            EntityParameter entityParameter = innerList[index];

            innerList[index] = (EntityParameter)newValue;
            entityParameter.ResetParent();
        }
예제 #4
0
 /// <summary>
 /// Adds an array of values to the end of the
 /// <see cref="T:System.Data.Entity.Core.EntityClient.EntityParameterCollection" />
 /// .
 /// </summary>
 /// <param name="values">
 /// The <see cref="T:System.Array" /> values to add.
 /// </param>
 public override void AddRange(Array values)
 {
     this.OnChange();
     Check.NotNull <Array>(values, nameof(values));
     foreach (object obj in values)
     {
         EntityParameterCollection.ValidateType(obj);
     }
     foreach (EntityParameter entityParameter in values)
     {
         this.Validate(-1, (object)entityParameter);
         this.InnerList.Add(entityParameter);
     }
 }
예제 #5
0
        /// <summary>Removes the specified parameter from the collection.</summary>
        /// <param name="value">
        /// A <see cref="T:System.Object" /> object to remove from the collection.
        /// </param>
        public override void Remove(object value)
        {
            this.OnChange();
            Check.NotNull <object>(value, nameof(value));
            EntityParameterCollection.ValidateType(value);
            int index = this.IndexOf(value);

            if (-1 != index)
            {
                this.RemoveIndex(index);
            }
            else if (this != ((EntityParameter)value).CompareExchangeParent((object)null, (object)this))
            {
                throw new ArgumentException(Strings.EntityParameterCollectionRemoveInvalidObject);
            }
        }
예제 #6
0
 /// <summary>
 /// Gets the location of the specified <see cref="T:System.Object" /> in the collection.
 /// </summary>
 /// <returns>
 /// The zero-based location of the specified <see cref="T:System.Object" /> that is a
 /// <see cref="T:System.Data.Entity.Core.EntityClient.EntityParameter" />
 /// in the collection. Returns -1 when the object does not exist in the
 /// <see cref="T:System.Data.Entity.Core.EntityClient.EntityParameterCollection" />
 /// .
 /// </returns>
 /// <param name="value">
 /// The <see cref="T:System.Object" /> to find.
 /// </param>
 public override int IndexOf(object value)
 {
     if (value != null)
     {
         EntityParameterCollection.ValidateType(value);
         List <EntityParameter> innerList = this.InnerList;
         if (innerList != null)
         {
             int count = innerList.Count;
             for (int index = 0; index < count; ++index)
             {
                 if (value == innerList[index])
                 {
                     return(index);
                 }
             }
         }
     }
     return(-1);
 }