public static IHtmlString PropertyName(this ApiServices context, DocumentedProperty property) { if (property != null) { return MvcHtmlString.Create(property.Definition.Name); } return MvcHtmlString.Create(string.Empty); }
public static IHtmlString BreadCrumb(this ApiServices context, DocumentedProperty property) { var breadcrumb = new Breadcrumb(); breadcrumb.AppendApiRoot(); breadcrumb.AppendNamespaces(context, property.Type.Namespace, true); breadcrumb.AppendType(context, property.Type, true); breadcrumb.AppendProperty(context, property); return breadcrumb.Render(); }
public static IHtmlString PropertyLink(this ApiServices context, DocumentedProperty property) { if (property != null) { var url = context.UrlResolver.GetUrl(property.Identity); if (url != null) { var writer = new HtmlTextWriter(new StringWriter()); writer.AddAttribute(HtmlTextWriterAttribute.Href, url); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.WriteEncodedText(property.Definition.Name); writer.RenderEndTag(); return MvcHtmlString.Create(writer.InnerWriter.ToString()); } return MvcHtmlString.Create(property.Definition.Name); } return MvcHtmlString.Create(string.Empty); }
public PropertyViewModel(DocumentedProperty data) { Data = data; }
private string GetUrl(DocumentedProperty property) { var nsRoute = _service.GetRoutePart(property.Type.Namespace); var typeRoute = _service.GetRoutePart(property.Type); var propertyRoute = _service.GetRoutePart(property); return string.Concat(nsRoute, "/", typeRoute, "/", propertyRoute); }
public string GetRoutePart(DocumentedProperty property) { return string.Format("{0:X8}", property.Identity.GetHashCode()).ToLowerInvariant(); }
public string GetRoutePart(DocumentedProperty property) { return $"{property.Identity.GetHashCode():X8}".ToLowerInvariant(); }
public static void AppendProperty(this IBreadcrumbItem breadcrumb, ApiServices context, DocumentedProperty property) { breadcrumb.Append(new BreadcrumbItem(MvcHtmlString.Create(property.Definition.Name))); }