4acd33d5ca | ||
---|---|---|
Templates | ||
README.md |
README.md
Scaffold Templates for UI for ASP.NET Core
This repository contains scaffold templates that are alternatives to the native .NET Core scaffold templates for web application with MVC and RazorPages.
Getting Started
The scaffolding logic and tools are the same as with the ordinary .NET Core web applications. The main repository and logic for the scaffolding provided by Microsoft is in this repository: https://github.com/aspnet/Scaffolding. The original template files are located here: https://github.com/aspnet/Scaffolding/tree/master/src/VS.Web.CG.Mvc/Templates.
In order to use the scaffolding provided by Microsoft you can follow these resources:
Installing the Kendo UI for ASP.NET Core Scaffold templates
Make sure that Telerik UI for ASP.NET Core is installed and set up in your project.
In order to install the scaffold templates from this repository just copy the Templates folder and include it in the root of the created project:
As of .NET Core 2.2, when using Bootstrap 3, the views folder used is
ViewGenerator_Versioned\Bootstrap3\
. If you are upgrading your project make sure to update the folder's name.
Make sure to exclude the folder from the project so that those files are not compiled. Or you can add the exclude statement manually in the .csproj file:
<ItemGroup>
<Compile Remove="Templates\**" />
<Content Remove="Templates\**" />
<EmbeddedResource Remove="Templates\**" />
<None Remove="Templates\**" />
</ItemGroup>
Next, using the build-in scaffolding utility will output cshtml generated using the custom templates included. In this case, the inputs generated will be the Telerik UI for ASP.NET Core components corresponding to the type of the field.
String
:input
element with Kendo styles;String
(multiline):textarea
element with Kendo styles;Number
:kendo-numerictextbox
tag helper;DateTime
:kendo-datetimepicker
tag helper;Boolean
:Html.Kendo().CheckBoxFor
helper;
ViewGenerator/List.cshtml template, which scaffolds
kendo-grid
tag helper, requires Entity Framework data context to scaffold successfully. If there is no Entity, the following error will be thrown on scaffolding:"Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore.CodeModel does not contain a definition for EntitySetName"