コード例 #1
0
        private string ParseType(XElement type)
        {
            //if (type.NullableElement("ref").IsNull())
            //{
            //    return type.NullableValue();
            //}
            if (type.IsNull())
            {
                return(type.NullableValue());
            }

            List <SpecViewModel> specs = (from node in type.CreateNavigator().Select("node()").Cast <XPathNavigator>()
                                          select node.Name == "ref" ? new SpecViewModel {
                Uid = node.GetAttribute("refid", string.Empty), IsExternal = false,
            } : new SpecViewModel {
                Name = node.Value, FullName = node.Value
            }).ToList();

            if (specs.Count == 1 && specs[0].Uid != null)
            {
                return(specs[0].Uid);
            }
            string uid = string.Concat(specs.Select(spec => spec.Uid ?? StringUtility.ComputeHash(spec.Name)));

            _references.Add(CreateReferenceWithSpec(uid, specs));
            return(uid);
        }