This commit is contained in:
Chris
2026-04-07 20:35:53 +02:00
parent a0e60d2a4d
commit 947b34ad13
212 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
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");
}
}