mirror of
https://gitea.tendokyu.moe/Kayori/MedusaPluginChargeMachine.git
synced 2026-09-25 07:38:15 +03:00
22 lines
780 B
C#
22 lines
780 B
C#
using MedusaPluginChargeMachine.Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace MedusaPluginChargeMachine;
|
|
|
|
public class ChargeMachineDbContext(DbContextOptions<ChargeMachineDbContext> options) : DbContext(options)
|
|
{
|
|
public DbSet<ChargeHistory> ChargeHistories { get; set; }
|
|
public DbSet<ArticleContent> ArticleContents { get; set; }
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
|
|
// Store ArticleType enum as its member name string (e.g. "DOCMT_0001") so the
|
|
// value is human-readable in the DB and matches the wire protocol exactly.
|
|
modelBuilder.Entity<ArticleContent>()
|
|
.Property(a => a.ArticleType)
|
|
.HasConversion<string>();
|
|
}
|
|
}
|