/// <summary> /// Adds the given expression. /// </summary> /// <param name="expression"></param> /// <returns></returns> public EntityViewProperty Add(object expression) { if (expression == null) { throw new ArgumentNullException("expression"); } // string? if (expression is string) { return(Add((string)expression)); } // member? if (expression is EntityMember) { // create... EntityViewProperty property = ((EntityMember)expression).GetViewProperty(); if (property == null) { throw new ArgumentNullException("property"); } // add... this.Add(property); // return... return(property); } // nope... throw new NotSupportedException(string.Format(Cultures.Exceptions, "Cannot handle '{0}'.", expression.GetType())); }
/// <summary> /// Adds a EntityViewProperty instance to the collection. /// </summary> /// <param name="item">The item to add.</param> public void Insert(int index, EntityViewProperty item) { if (item == null) { throw new ArgumentNullException("item"); } List.Insert(index, item); }
/// <summary> /// Adds a EntityViewProperty instance to the collection. /// </summary> /// <param name="item">The item to add.</param> public int Add(EntityViewProperty item) { if (item == null) { throw new ArgumentNullException("item"); } return(List.Add(item)); }
/// <summary> /// Removes a EntityViewProperty item to the collection. /// </summary> /// <param name="item">The item to remove.</param> public void Remove(EntityViewProperty item) { if (item == null) { throw new ArgumentNullException("item"); } List.Remove(item); }
/// <summary> /// Discovers if the given item is in the collection. /// </summary> /// <param name="item">The item to find.</param> /// <returns>Returns true if the given item is in the collection.</returns> public bool Contains(EntityViewProperty item) { if (IndexOf(item) == -1) { return(false); } else { return(true); } }
/// <summary> /// Adds the given expression. /// </summary> /// <param name="expression"></param> public EntityViewProperty Add(string expression) { if (expression == null) { throw new ArgumentNullException("expression"); } if (expression.Length == 0) { throw ExceptionHelper.CreateZeroLengthArgumentException("expression"); } // add... if (EntityType == null) { throw new ArgumentNullException("EntityType"); } EntityViewProperty newProperty = this.EntityType.CreateViewProperty(expression); // add... this.Add(newProperty); // return... return(newProperty); }
/// <summary> /// Returns the index of the item in the collection. /// </summary> /// <param name="item">The item to find.</param> /// <returns>The index of the item, or -1 if it is not found.</returns> public int IndexOf(EntityViewProperty item) { return(List.IndexOf(item)); }