/// <summary>Loads documentation from XML.</summary> public static Documentation LoadFromXml(XElement xml) { if (xml == null) return null; try { Documentation result = new Documentation(); foreach (XElement xItem in xml.Elements("Item")) { string tag = xItem.Attribute("tag").ToString(); string cnt = xItem.Attribute("content").ToString(); result.Items.Add(new DocumentationItem(tag, cnt)); } return result; } catch (Exception) { return null; } }
/// <summary>Initializes a new instance of the <see cref="BplProperty"/> class.</summary> public MetaProperty(BplProperty bplProperty) { // Fill class level attributes this.Name = bplProperty.Name; this.CanonicName = bplProperty.CanonicName; this.IsScalar = !(bplProperty.IsArray || bplProperty.IsCollection); this.IsArray = bplProperty.IsArray; this.IsCollection = bplProperty.IsCollection; this.IsPrimitive = bplProperty.IsPrimitive; if (this.IsArray || this.IsCollection) { this.DataType = Repository.ResolveType(bplProperty.UnderlyingItemType.FullName); } else { this.DataType = Repository.ResolveType(bplProperty.UnderlyingType.FullName); } if (this.DataType.Contains("[[")) { this.DataType = bplProperty.IsNullable ? string.Format("{0}?", bplProperty.UnderlyingItemType.FullName) : bplProperty.UnderlyingItemType.FullName; } this.IsReadOnly = bplProperty.IsCalculated; var documentation = BplLanguage.Documentation[bplProperty].Content; if (documentation != null) { this.Documentation = new Documentation(documentation); } // Register primitive type /*****************************/ if (bplProperty.IsPrimitive) { if (bplProperty.PrimitiveType.IsEnum) { MetaEnum me = new MetaEnum(bplProperty.PrimitiveType); } else { if (this.IsScalar) { if (!Repository.TypesMapper.ContainsKey(bplProperty.UnderlyingType.FullName)) { MetaPrimitive mp = new MetaPrimitive(bplProperty.PrimitiveType); } } else { if (!Repository.TypesMapper.ContainsKey(bplProperty.UnderlyingItemType.FullName)) { MetaPrimitive mp = new MetaPrimitive(bplProperty.PrimitiveType.ItemType); } } } } /*****************************/ }
/// <summary>Get package level documentation.</summary> private Documentation getPackageDocumentation() { Documentation doc = new Documentation(); doc.AddItem(string.Format("Package: {0}", this.CanonicName)); return doc; }