Esempio n. 1
0
 public static IHtmlString PropertyName(this ApiServices context, DocumentedProperty property)
 {
     if (property != null)
     {
         return MvcHtmlString.Create(property.Definition.Name);
     }
     return MvcHtmlString.Create(string.Empty);
 }
Esempio n. 2
0
 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();
 }
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
 public PropertyViewModel(DocumentedProperty data)
 {
     Data = data;
 }
Esempio n. 5
0
 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);
 }
Esempio n. 6
0
 public string GetRoutePart(DocumentedProperty property)
 {
     return string.Format("{0:X8}", property.Identity.GetHashCode()).ToLowerInvariant();
 }
Esempio n. 7
0
 public string GetRoutePart(DocumentedProperty property)
 {
     return $"{property.Identity.GetHashCode():X8}".ToLowerInvariant();
 }
Esempio n. 8
0
 public static void AppendProperty(this IBreadcrumbItem breadcrumb, ApiServices context, DocumentedProperty property)
 {
     breadcrumb.Append(new BreadcrumbItem(MvcHtmlString.Create(property.Definition.Name)));
 }