This project demonstrates how to build a complete CRUD module using ASP.NET Core MVC, Entity Framework Core, and Database-First Scaffolding.
All Models, DbContext, Controllers, and Razor Views were auto-generated using EF Core tooling and ASP.NET Core scaffolding.
Perfect project to showcase real-world .NET Core development with SQL Server and MVC architecture.
A quick summary of the EF Core Database-First scaffolding steps used to build this CRUD app.
-
Install EF tools
dotnet tool install --global dotnet-ef
dotnet tool install --global dotnet-aspnet-codegenerator
-
📦 Installed EF Core Packages (csproj) EF Core and scaffolding works using these packages:
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.10" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.7" />
</ItemGroup>3.Configure connection string (appsettings.json)
"ConnectionStrings": {
"DefaultConnection": "Server=.;Database=MyDb;Trusted_Connection=True;TrustServerCertificate=True"
}
4.Register DbContext (Program.cs)
builder.Services.AddDbContext<ApplicationDbContext>(opts =>
opts.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
5.Scaffold Models + DbContext (Database-First)
dotnet ef dbcontext scaffold "Server=.;Database=MyDb;Trusted_Connection=True;TrustServerCertificate=True" \
Microsoft.EntityFrameworkCore.SqlServer -o Models -c ApplicationDbContext --context-dir Data --force
-o Models → put entities in Models folder
-c ApplicationDbContext → name the DbContext class
--context-dir Data → place DbContext in Data folder
6.Scaffold Controller + Views (CRUD UI)
dotnet aspnet-codegenerator controller -name EmployeesController \
-m ScaffoldingCRUD.Models.Employee -dc ScaffoldingCRUD.Data.ApplicationDbContext \
--relativeFolderPath Controllers --useDefaultLayout --referenceScriptLibraries
7.Run & verify
dotnet run
Done. Files generated: /Models/, /Data/ApplicationDbContext.cs, /Controllers/EmployeesController.cs, /Views/Employees/.
This project highlights strong proficiency in building robust, maintainable, and enterprise-ready applications with ASP.NET Core and EF Core, following proven architectural patterns and professional coding standards.