/// <summary> /// Adds an xml comment to the entity type. /// </summary> /// <param name="commentText">Text contained in the comment.</param> public void AddComment(string commentText) { if (_entityTypeElement != null && _entityTypeElement.ParentNode != null) { XmlComment commentElement = EDMXDocument.CreateComment(commentText); _entityTypeElement.AppendChild(commentElement); } }
private void AddSaveComment() { System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly(); string version = asm.GetName().Version.ToString(); //remove old update comments foreach (XmlComment xc in EDMXDocument.DocumentElement.ChildNodes.OfType <XmlComment>().ToList()) { string value = xc.Value; if (!string.IsNullOrEmpty(value)) { if (value.Trim().StartsWith("Updated by Huagati EDMX Tools")) { xc.ParentNode.RemoveChild(xc); } } } //add a new update comment XmlComment comment = EDMXDocument.CreateComment("Updated by Huagati EDMX Tools version " + version + " on " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", new System.Globalization.CultureInfo("en-us").DateTimeFormat)); EDMXDocument.DocumentElement.InsertBefore(comment, EDMXDocument.DocumentElement.ChildNodes[0]); }