Пример #1
0
        /// <summary>
        /// Gets the property or relation
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        /// <returns></returns>
        public Property GetProperty(string propertyName)
        {
            if (AllProperties.Contains(propertyName))
            {
                return(AllProperties[propertyName]);
            }

            return(null);
        }
Пример #2
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);
        }
Пример #3
0
 /// <summary>
 /// Determines whether [contains] [the specified item].
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>
 ///     <c>true</c> if [contains] [the specified item]; otherwise, <c>false</c>.
 /// </returns>
 public bool Contains(Property item)
 {
     return(AllProperties.Contains(item));
 }
Пример #4
0
 /// <summary>
 /// Determines whether the specified property name contains property.
 /// </summary>
 /// <param name="propertyName">Name of the property.</param>
 /// <returns>
 ///     <c>true</c> if the specified property name contains property; otherwise, <c>false</c>.
 /// </returns>
 public bool ContainsProperty(string propertyName)
 {
     return(AllProperties.Contains(propertyName));
 }