/// <summary>
 /// Add the specified property meta-data to the list of properties
 /// associated with this component.
 /// </summary>
 /// <param name="property">
 /// The meta-data to add.
 /// </param>
 public void AddProperty(IFiftyOneAspectPropertyMetaData property)
 {
     if (GetProperties().Any(p => p.Name == property.Name) == false)
     {
         _properties.Add(property);
     }
 }
 public ValueMetaDataDefault(string name, string description,
                             string url, IFiftyOneAspectPropertyMetaData property)
 {
     Name        = name;
     Description = description;
     Url         = url;
     _property   = property;
 }
 /// <summary>
 /// Check if this instance is equal to another object that
 /// implements <see cref="IFiftyOneAspectPropertyMetaData"/>.
 /// </summary>
 /// <param name="other">
 /// The <see cref="IFiftyOneAspectPropertyMetaData"/> to check for
 /// equality
 /// </param>
 /// <returns>
 /// True if the two instances are equal.
 /// False otherwise
 /// </returns>
 public bool Equals(IFiftyOneAspectPropertyMetaData other)
 {
     if (other == null)
     {
         return(false);
     }
     return(Name.Equals(other.Name, StringComparison.OrdinalIgnoreCase));
 }
 /// <summary>
 /// Compare this instance to another object that implements
 /// <see cref="IFiftyOneAspectPropertyMetaData"/>.
 /// </summary>
 /// <param name="other">
 /// The object to compare to.
 /// </param>
 /// <returns>
 /// &gt;0 if this instance precedes `other` in the sort order.
 /// 0 if they are equal in the sort order.
 /// &lt;0 if `other` precedes this instance in the sort order.
 /// </returns>
 public int CompareTo(IFiftyOneAspectPropertyMetaData other)
 {
     if (other == null)
     {
         return(-1);
     }
     return(string.Compare(Name, other.Name,
                           StringComparison.OrdinalIgnoreCase));
 }
Пример #5
0
        /// <summary>
        /// Get the meta-data for the specified property.
        /// </summary>
        /// <param name="propertyName">
        /// The name of the property to get the meta-data for.
        /// </param>
        /// <returns>
        /// The meta-data for the specified property.
        /// </returns>
        public IFiftyOneAspectPropertyMetaData GetProperty(string propertyName)
        {
            IFiftyOneAspectPropertyMetaData result = null;

            using (var properties =
                       _engine.MetaData.getPropertiesForComponent(_source))
            {
#pragma warning disable CA2000 // Dispose objects before losing scope
                // The 'PropertyMetaDataHash' instance uses the property
                // object and will dispose of it when it is no longer
                // needed.
                var property = properties.getByKey(propertyName);
#pragma warning restore CA2000 // Dispose objects before losing scope
                if (property != null)
                {
                    result = new PropertyMetaDataHash(_engine, property);
                }
            }
            return(result);
        }
 /// <summary>
 /// Set the meta-data for the property that this value is for.
 /// </summary>
 /// <param name="property"></param>
 public void SetProperty(IFiftyOneAspectPropertyMetaData property)
 {
     _property = property;
 }