///-------------------------------------------------------------------------------- /// <summary>This property returns a copy of the forward engineering data for the solution.</summary> ///-------------------------------------------------------------------------------- public RecentSolution GetForwardInstance(Solution forwardSolution) { bool isCustomized = false; RecentSolution forwardItem = new RecentSolution(); if (ForwardInstance != null) { forwardItem.TransformDataFromObject(ForwardInstance, null, false); isCustomized = true; } else { forwardItem.RecentSolutionId = RecentSolutionId; } if (isCustomized == false) { return(null); } forwardItem.SpecSourceName = DefaultSourceName; if (forwardSolution.ReferencedModelIDs.Find("ItemName", forwardItem.SpecSourceName) == null) { forwardSolution.ReferencedModelIDs.Add(CreateIDReference()); } #region protected #endregion protected return(forwardItem); }
///-------------------------------------------------------------------------------- /// <summary>This method assigns a value to a property, and updates corresponding /// forward and reverse engineering data.</summary> /// /// <param name="propertyName">The property name.</param> /// <param name="propertyValue">The property value.</param> ///-------------------------------------------------------------------------------- public virtual bool AssignProperty(string propertyName, object propertyValue) { if (this.SetPropertyValue(propertyName, propertyValue) == true) { if (ReverseInstance == null) { ReverseInstance = new RecentSolution(); ReverseInstance.TransformDataFromObject(this, null, false); } else { ReverseInstance.SetPropertyValue(propertyName, propertyValue); } if (ForwardInstance != null) { this.TransformDataFromObject(ForwardInstance, null, false, true); } } else { return(false); } #region protected #endregion protected return(true); }
///-------------------------------------------------------------------------------- /// <summary>This method determines whether the input instance metadata is /// effectively empty.</summary> /// /// <param name="inputRecentSolution">The recentsolution to compare metadata.</param> ///-------------------------------------------------------------------------------- public bool IsEmptyMetadata(RecentSolution inputRecentSolution) { if (inputRecentSolution == null) { return(true); } if (inputRecentSolution.TagList.Count > 0) { return(false); } if (!String.IsNullOrEmpty(inputRecentSolution.RecentSolutionName)) { return(false); } if (!String.IsNullOrEmpty(inputRecentSolution.RecentSolutionLocation)) { return(false); } if (LastAccessedDate != inputRecentSolution.LastAccessedDate) { return(false); } #region protected #endregion protected return(true); }
///-------------------------------------------------------------------------------- /// <summary>This method copies changed metadata between the input /// instance and the current instance.</summary> /// /// <param name="inputRecentSolution">The recentsolution to get metadata.</param> ///-------------------------------------------------------------------------------- public void CopyChangedMetadata(RecentSolution inputRecentSolution) { RecentSolutionName = inputRecentSolution.RecentSolutionName; RecentSolutionLocation = inputRecentSolution.RecentSolutionLocation; LastAccessedDate = inputRecentSolution.LastAccessedDate; #region protected #endregion protected }
///-------------------------------------------------------------------------------- /// <summary>This method adds a tag to TagList.</summary> ///-------------------------------------------------------------------------------- public override void AddTag(string tagName) { if (ReverseInstance == null) { ReverseInstance = new RecentSolution(); ReverseInstance.TransformDataFromObject(this, null, false); } base.AddTag(tagName); if (ForwardInstance == null) { ForwardInstance = new RecentSolution(); ForwardInstance.RecentSolutionId = RecentSolutionId; } if (ForwardInstance.TagList.Find(t => t.TagName == tagName) == null) { ForwardInstance.TagList.Add(new Tag(Guid.NewGuid(), tagName)); } }
///-------------------------------------------------------------------------------- /// <summary>This method determines whether or not any metadata is /// different between the input instance and the current instance.</summary> /// /// <param name="inputRecentSolution">The recentsolution to compare metadata.</param> ///-------------------------------------------------------------------------------- public bool IsIdenticalMetadata(RecentSolution inputRecentSolution) { if (RecentSolutionName.GetString() != inputRecentSolution.RecentSolutionName.GetString()) { return(false); } if (RecentSolutionLocation.GetString() != inputRecentSolution.RecentSolutionLocation.GetString()) { return(false); } if (LastAccessedDate.GetDateTime() != inputRecentSolution.LastAccessedDate.GetDateTime()) { return(false); } #region protected #endregion protected return(true); }