Exemplo n.º 1
0
        /// <summary>
        /// Removes the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns></returns>
        public bool Remove(Property item)
        {
            if ((item == null) || string.IsNullOrWhiteSpace(item.PropertyName))
            {
                return(false);
            }
            bool res = false;

            if (PrimaryKey != null)
            {
                if (PrimaryKey.Keys.Contains(item.PropertyName))
                {
                    PrimaryKey.Keys.Remove(item.PropertyName);
                    res = true;
                }
            }

            if (Properties.Contains(item.PropertyName))
            {
                Properties.Remove(item.PropertyName);
                res = true;
            }
            else if (Relations.Contains(item.PropertyName))
            {
                Relations.Remove(item.PropertyName);
                res = true;
            }

            if (AllProperties.Contains(item.PropertyName))
            {
                AllProperties.Remove(item.PropertyName);
                res = true;
            }

            return(res);
        }