///-------------------------------------------------------------------------------- /// <summary>This method disposes of resources in the model.</summary> ///-------------------------------------------------------------------------------- protected override void OnDispose() { if (ReverseInstance != null) { ReverseInstance.Dispose(); ReverseInstance = null; } if (ForwardInstance != null) { ForwardInstance.Dispose(); ForwardInstance = null; } ModelObject = null; Solution = null; if (_propertyInstanceList != null) { foreach (PropertyInstance item in PropertyInstanceList) { item.Dispose(); } PropertyInstanceList.Clear(); PropertyInstanceList = null; } #region protected #endregion protected base.OnDispose(); }
///-------------------------------------------------------------------------------- /// <summary>This method gets the property value for the input property name.</summary> /// /// <param name="propertyName">The name of the property to get the value of.</param> /// <param name="propertyFound">Output flag, indicating whether property was found or not.</param> ///-------------------------------------------------------------------------------- public string GetStringValue(string propertyName, out bool propertyFound) { StringBuilder value = new StringBuilder(); propertyFound = false; ModelProperty property = ModelObject.ModelPropertyList.Find(p => p.ModelPropertyName == propertyName); if (property != null && PropertyInstanceList.Count > 0) { propertyFound = true; foreach (PropertyInstance instance in PropertyInstanceList.FindAll(i => i.ModelPropertyID == property.ModelPropertyID)) { if (value.ToString() != String.Empty) // && property.IsCollection == true) { value.Append(", ").Append(instance.PropertyValue); } else { value.Append(instance.PropertyValue); } } } return(value.ToString()); }