using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using CellularManagement.Domain.Entities.Device; namespace CellularManagement.Infrastructure.Configurations.Device; public class DeviceStatusConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("DeviceStatuses", t => t.HasComment("设备状态表")); builder.HasKey(s => s.Id); // 配置属性 builder.Property(s => s.Id).HasComment("状态ID"); builder.Property(s => s.Name).IsRequired().HasMaxLength(50).HasComment("状态名称"); builder.Property(s => s.Description).HasMaxLength(200).HasComment("状态描述"); builder.Property(s => s.CreatedAt).IsRequired().HasComment("创建时间"); builder.Property(s => s.UpdatedAt).IsRequired().HasComment("更新时间"); } }