1. Create a new project asp.net core with MVC (model view controller)
2. Install 3 packeges
a. Microsoft.EntityFrameworkCore
b. Microsoft.EntityFrameworkCore.SqlServer
c. Microsoft.EntityFrameworkCore.Tools
3. go to the program.cs if you are version 6 or a startup.cs if used under version 6 and add some features
for performing it.
builder.Services.AddDbContext<Context>(option => option.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
4. Add some feature in your context file
public class Context: DbContext
{
public Context(DbContextOptions<Context> options): base(options)
{
}
public DbSet<Student> Students { get; set; }
}
0 Comments
If you have any questions, please let me know