@inherits Microsoft.Extensions.CodeGeneration.Templating.RazorTemplateBase @using Microsoft.Extensions.CodeGeneration.EntityFramework @@model @Model.ViewDataTypeName @{ if (Model.IsPartialView) { } else if (Model.IsLayoutPageSelected) { @:@@{ @:ViewData["Title"] = @@Model.ViewName"]; if (!string.IsNullOrEmpty(Model.LayoutPageFile)) { @:Layout = "@Model.LayoutPageFile"; } @:} @: @:

@@Model.ViewName"]

@: } else { @:@@{ @:Layout = "null"; @:} @: @: @: @: @: @: @:@Model.ViewName @: @: @: // PushIndent(" "); } @:
@:
@:

@@Model.ViewDataTypeShortName"]

@:
@:
foreach (var property in Model.ModelMetadata.Properties) { if (property.Scaffold && !property.IsAutoGenerated && !property.IsReadOnly) { // If the property is a primary key and Guid, then the Guid is generated in the controller. Hence, this propery is not displayed on the view. if (property.IsPrimaryKey) { continue; } if (property.IsForeignKey) { @:
@: @:
@: @:
@:
continue; } bool isCheckbox = property.TypeName.Equals("System.Boolean"); if (isCheckbox) { @:
@:
@:
@: @: @:
@:
@:
} else if (property.IsEnum && !property.IsEnumFlags) { @:
@: @:
@: @: @:
@:
} else { @:
@: @:
@: @: @:
@:
} } } }
@Back to List
@{ if (Model.ReferenceScriptLibraries && (Model.IsLayoutPageSelected || Model.IsPartialView)) { @:@@section Scripts { @: @: @: @:} } // The following code closes the tag used in the case of a view using a layout page and the body and html tags in the case of a regular view page if (!Model.IsPartialView && !Model.IsLayoutPageSelected) { if (Model.ReferenceScriptLibraries) { @:@@section Scripts { @: @: @: @:} //ClearIndent(); } @: @: } } @functions { // Do we need to use this in conjunction with the PrimaryKey check? bool IsPropertyGuid(PropertyMetadata property) { return string.Equals("System.Guid", property.TypeName, StringComparison.OrdinalIgnoreCase); } }