.NET Kendo CRUD Generator
VS Code extension that generates a starter ASP.NET Core MVC CRUD screen using Telerik UI for ASP.NET Core / Kendo MVC Grid helpers.
Features
- Adds the
Generate .NET CRUD command.
- Prompts for:
- model name
- fields, for example
Name:string, Price:decimal, IsActive:bool
- EF Core
DbContext class name
- app root namespace
- Generates:
Models/<Model>.cs - Entity model class
Repositories/Interfaces/I<Model>Repository.cs - Repository interface
Repositories/<Model>Repository.cs - Repository implementation with data access logic
Controllers/<Models>Controller.cs - Controller with dependency injection
Views/<Models>/Index.cshtml - Kendo Grid view
Requirements In The Target .NET App
The generated files assume your ASP.NET Core MVC project already has:
- EF Core configured
- a registered
DbContext
- Telerik UI for ASP.NET Core / Kendo MVC installed and configured
- Kendo scripts and styles loaded in your layout
After generation, you need to:
Add the generated model to your DbContext:
public DbSet<Product> Products => Set<Product>();
Add session support and register the repository in Program.cs:
using YourApp.Repositories.Interfaces;
using YourApp.Repositories;
// Add session support
builder.Services.AddDistributedMemoryCache();
builder.Services.AddSession(options =>
{
options.IdleTimeout = TimeSpan.FromMinutes(30);
options.Cookie.HttpOnly = true;
options.Cookie.IsEssential = true;
});
// Register repository
builder.Services.AddScoped<IProductRepository, ProductRepository>();
var app = builder.Build();
app.UseSession(); // Add this before UseRouting()
Create a migration and update the database:
dotnet ef migrations add AddProduct
dotnet ef database update
Run During Development
npm install
npm run compile
Then press F5 in VS Code to launch the Extension Development Host and run Generate .NET CRUD from the command palette.
| |