You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.6 KiB
30 lines
1.6 KiB
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
using CellularManagement.Domain.Entities.Device;
|
|
|
|
namespace CellularManagement.Infrastructure.Configurations.Device;
|
|
|
|
public class ScenarioConfiguration : IEntityTypeConfiguration<Scenario>
|
|
{
|
|
public void Configure(EntityTypeBuilder<Scenario> builder)
|
|
{
|
|
builder.ToTable("Scenarios", t => t.HasComment("场景表"));
|
|
builder.HasKey(s => s.Id);
|
|
|
|
// 配置索引
|
|
builder.HasIndex(s => s.Code).IsUnique().HasDatabaseName("IX_Scenarios_Code");
|
|
builder.HasIndex(s => s.NetworkConfigId).HasDatabaseName("IX_Scenarios_NetworkConfigId");
|
|
|
|
// 配置属性
|
|
builder.Property(s => s.Id).HasComment("场景ID");
|
|
builder.Property(s => s.Code).IsRequired().HasMaxLength(50).HasComment("场景编码");
|
|
builder.Property(s => s.Name).IsRequired().HasMaxLength(100).HasComment("场景名称");
|
|
builder.Property(s => s.NetworkConfigId).IsRequired().HasMaxLength(50).HasComment("网络配置ID");
|
|
builder.Property(s => s.Description).HasMaxLength(1000).HasComment("说明");
|
|
builder.Property(s => s.IsDisabled).IsRequired().HasComment("是否禁用");
|
|
builder.Property(s => s.CreatedAt).IsRequired().HasColumnType("timestamp with time zone").HasComment("创建时间");
|
|
builder.Property(s => s.UpdatedAt).HasColumnType("timestamp with time zone").HasComment("更新时间");
|
|
builder.Property(s => s.CreatedBy).IsRequired().HasMaxLength(50).HasComment("创建人");
|
|
builder.Property(s => s.UpdatedBy).HasMaxLength(50).HasComment("修改人");
|
|
}
|
|
}
|