예제 #1
0
        /// <summary>
        /// Gets property value.
        /// </summary>
        /// <param name="propertyName">Short name of the property to get. Eg. "Name"</param>
        /// <returns>String, Double, ValueId or IList&lt;ValueId&gt;.</returns>
        /// <exception cref="KeyNotFoundException">If no property found.</exception>
        public virtual object GetProperty(string propertyName)
        {
            if (propertyName == EffortProperty)
            {
                return(EntityContainer.GetEffort(this));
            }

            var attribute = Asset.Attributes[TypePrefix + '.' + propertyName];
            var allValues = GetPropertyValues(propertyName);

            if (attribute.Definition.IsMultiValue)
            {
                var currentValues = attribute.Values;
                return(allValues == null ? currentValues : allValues.Subset(attribute.Values));
            }

            var value = attribute.Value;

            if (value is Oid)
            {
                return(allValues == null ? value : allValues.Find((Oid)value));
            }

            return(value);
        }