getElementWrapperByGUID() 공개 메소드

Finds the EA.Element with the given GUID and returns an EAElementwrapper wrapping this element.
public getElementWrapperByGUID ( string GUID ) : ElementWrapper
GUID string the GUID of the element
리턴 ElementWrapper
예제 #1
0
        public static List <MappingLogic> getMappingLogicsFromString(string logicsString, TSF_EA.Model model)
        {
            var mappingLogics = new List <MappingLogic>();

            if (!string.IsNullOrEmpty(logicsString))
            {
                try
                {
                    XDocument xdoc = XDocument.Load(new System.IO.StringReader(logicsString));
                    foreach (var logicNode in xdoc.Descendants("mappingLogic"))
                    {
                        string contextID = logicNode.Elements("context").FirstOrDefault()?.Value;
                        TSF_EA.ElementWrapper contextElement = model.getElementWrapperByGUID(contextID);
                        string description = logicNode.Elements("description").FirstOrDefault()?.Value;
                        //only create mapping logic if the description exists, or the contextElement exists.
                        if (!string.IsNullOrEmpty(description) || contextElement != null)
                        {
                            mappingLogics.Add(new MappingLogic(description, contextElement));
                        }
                    }
                }
                catch (System.Xml.XmlException)
                {
                    //no xml found, just plain text
                    mappingLogics.Add(new MappingLogic(logicsString));
                }
            }
            return(mappingLogics);
        }