@using HtmlGenerationWebSite.Components @using HtmlGenerationWebSite.Models @using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata @* Need the model directive in top-level view. Otherwise the controller would have to set the ViewData property. *@ @* Put another way, Controller lacks the View([...,] TModel) overloads that ViewComponent has. *@ @model ViewModel @{ var metadata = ViewData.ModelMetadata; }

View Model index

MetadataKind: '@metadata.MetadataKind'
ModelType: '@metadata.ModelType.Name'
@if (metadata.MetadataKind == ModelMetadataKind.Property) {
PropertyName: '@metadata.PropertyName'
}
@Html.DisplayFor(m => m, templateName: "LackModel")
@Html.Partial(partialViewName: "DisplayTemplates/LackModel.cshtml")
@(await Component.InvokeAsync())
@Html.DisplayFor(m => m.Integer, templateName: "Int32 - LackModel")
@Html.DisplayFor(m => m.NullableLong, templateName: "Int64 - LackModel")
@Html.DisplayFor(m => m.Template, templateName: "LackModel")