Files
Assignment6/6/Data/ApplicationDbContext.cs
Chris 2be781c3b1
Some checks failed
Build and Push Docker Image / docker (push) Failing after 18s
repo rework
2026-04-08 12:36:00 +00:00

31 lines
797 B
C#

using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Example.Models;
namespace Example.Data;
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext(DbContextOptions options)
: base(options)
{
}
public DbSet<Author> Authors => Set<Author>();
public DbSet<Book> Books => Set<Book>();
public DbSet<Review> Reviews => Set<Review>();
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Entity<Author>()
.Property(author => author.Birthdate)
.HasColumnType("date");
builder.Entity<Book>()
.Property(book => book.Published)
.HasColumnType("date");
}
}