public static IHtmlString Metadata <TDataController>(this HtmlHelper htmlHelper) where TDataController : DataController
        {
            HttpControllerDescriptor controllerDescriptor = new HttpControllerDescriptor
            {
                Configuration  = GlobalConfiguration.Configuration, // This helper can't be run until after global app init.
                ControllerType = typeof(TDataController)
            };

            DataControllerDescription description = DataControllerDescription.GetDescription(controllerDescriptor);
            IEnumerable <DataControllerMetadataGenerator.TypeMetadata> metadata =
                DataControllerMetadataGenerator.GetMetadata(description);

            JToken metadataValue = new JObject(metadata.Select(
                                                   m => new JProperty(m.EncodedTypeName, m.ToJToken())));

            return(htmlHelper.Raw(metadataValue));
        }
Exemple #2
0
 private static string EncodeServerTypeName(Type type)
 {
     return(DataControllerMetadataGenerator.EncodeTypeName(type));
 }