Core MVC EF
Core MVC EF
2. adding components
Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore.Tools
4. create class file in the Data Folder and named it with MVCDemoDataContext
5. Adding library
using ASPNETMVC.Models.Domain;
using Microsoft.EntityFrameworkCore;
using ASPNETMVC.Models.Domain;
using Microsoft.EntityFrameworkCore;
namespace ASPNETMVC.Data
{
public class MVCDemoDbContext : DbContext
{
public MVCDemoDbContext(DbContextOptions options) : base(options)
{
}
6. Create folder Domain inside folder models and add new class with name
Employee.cs, and create property
namespace ASPNETMVC.Models.Domain
{
public class Employee
{
public Guid Id { get; set; }
options.UseSqlServer(builder.Configuration.GetConnectionString("MvcDemoConnectionSt
ring")));
##########################################################
Create insert page
##########################################################