5 DbContext oluşturma

AppUser kullanıcısı ile yaptığımız genişletmeyi kullanarak üyelik sisteminde veritabanı işlemlerini yapacak bir tanımlama yapıyoruz. ApplicationDbContext tanımı veritabanı bağlantı yöneticisi olacaktır.

Models\DbContext.cs dosyasına aşağıdaki kodları ekliyoruz.

using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
public class ApplicationDbContext : IdentityDbContext<AppUser>
{
    public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
        : base(options)
    {
    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);
    }


}