SPMS_API/SPMS.Infrastructure/AppDbContext.cs

35 lines
1.3 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>();
public DbSet<Notice> Notices => Set<Notice>();
public DbSet<Banner> Banners => Set<Banner>();
public DbSet<Faq> Faqs => Set<Faq>();
public DbSet<AppConfig> AppConfigs => Set<AppConfig>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfigurationsFromAssembly(typeof(AppDbContext).Assembly);
}
}