22 lines
679 B
C#
22 lines
679 B
C#
|
|
using Microsoft.EntityFrameworkCore;
|
||
|
|
using SoroushAsadi.Models;
|
||
|
|
|
||
|
|
namespace SoroushAsadi.Database;
|
||
|
|
|
||
|
|
public class AppDbContext(DbContextOptions<AppDbContext> options) : DbContext(options)
|
||
|
|
{
|
||
|
|
public DbSet<ContentSection> ContentSections => Set<ContentSection>();
|
||
|
|
|
||
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||
|
|
{
|
||
|
|
modelBuilder.Entity<ContentSection>(e =>
|
||
|
|
{
|
||
|
|
e.ToTable("sections");
|
||
|
|
e.HasKey(x => x.Key);
|
||
|
|
e.Property(x => x.Key).HasColumnName("key");
|
||
|
|
e.Property(x => x.DataJson).HasColumnName("data");
|
||
|
|
e.Property(x => x.UpdatedAt).HasColumnName("updated_at");
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|