- 12개 Domain Entity 클래스 정의 (DB_Schema.md 기반) - 12개 EF Core Fluent API Configuration 구현 - AppDbContext에 DbSet 12개 등록 및 Configuration 자동 적용 - Soft Delete 글로벌 쿼리 필터 적용 (Service, Admin, Message) - DesignTimeDbContextFactory 추가 (EF Core CLI 지원) - InitialCreate 마이그레이션 생성 및 spms_dev DB 적용 완료 - .gitignore에 Documents/, CLAUDE.md, TASKS.md, .mcp.json 추가 Closes #8
31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using SPMS.Domain.Entities;
|
|
|
|
namespace SPMS.Infrastructure;
|
|
|
|
public class AppDbContext : DbContext
|
|
{
|
|
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
|
|
{
|
|
}
|
|
|
|
public DbSet<Service> Services => Set<Service>();
|
|
public DbSet<ServiceIp> ServiceIps => Set<ServiceIp>();
|
|
public DbSet<Admin> Admins => Set<Admin>();
|
|
public DbSet<Device> Devices => Set<Device>();
|
|
public DbSet<Message> Messages => Set<Message>();
|
|
public DbSet<FileEntity> Files => Set<FileEntity>();
|
|
public DbSet<PushSendLog> PushSendLogs => Set<PushSendLog>();
|
|
public DbSet<PushOpenLog> PushOpenLogs => Set<PushOpenLog>();
|
|
public DbSet<DailyStat> DailyStats => Set<DailyStat>();
|
|
public DbSet<WebhookLog> WebhookLogs => Set<WebhookLog>();
|
|
public DbSet<SystemLog> SystemLogs => Set<SystemLog>();
|
|
public DbSet<Payment> Payments => Set<Payment>();
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
modelBuilder.ApplyConfigurationsFromAssembly(typeof(AppDbContext).Assembly);
|
|
}
|
|
}
|