xiangning 6b7116fafd refactor(monitoring): 重构领域实体命名和枚举类型
- 将 AlertRule 重命名为 AlertRuleEntity
- 将 ExternalSystem 重命名为 ExternalSystemEntity
- 将 SyncJob 重命名为 SyncJobEntity
- 将 SyncedRecord 重命名为 SyncedRecordEntity
- 将 AlertSeverity 重命名为 AlertSeverityEnum
- 将 ExternalSystemType 重命名为 ExternalSystemTypeEnum
- 将 SyncJobStatus 重命名为 SyncJobStatusEnum
- 将相关实体的命名空间从 Entities 移至 Values
- 更新所有引用这些类型的代码以使用新名称
- 修改数据访问层配置以使用新的实体类型名称
2026-07-19 13:13:24 +08:00

33 lines
1.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Monitoring.Domain.Entities.AlertRule;
using Monitoring.Domain.Entities.ExternalSystem;
using Monitoring.Domain.Entities.SyncJob;
using Monitoring.Domain.Entities.SyncedRecord;
using Monitoring.Domain.Values;
namespace Monitoring.Infrastructure.Persistence.Configurations;
/// <summary>告警规则表映射(id + 外键索引列 + json_data + 审计)。</summary>
public class AlertRuleConfiguration : IEntityTypeConfiguration<AlertRuleEntity>
{
public void Configure(EntityTypeBuilder<AlertRuleEntity> builder)
{
builder.ToTable("b_alert_rules");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedNever().HasComment("规则ID");
builder.Property(e => e.ExternalSystemId).HasComment("绑定的外部系统ID");
builder.Property(e => e.JsonData).HasColumnType("jsonb").IsRequired().HasComment("业务数据: 名称/指标/阈值/运算符/严重级别/启用/冷却");
// 审计列
builder.Property(e => e.CreatedBy).HasMaxLength(100).HasComment("创建人");
builder.Property(e => e.CreatedAt).HasComment("创建时间");
builder.Property(e => e.UpdatedBy).HasMaxLength(100).HasComment("更新人");
builder.Property(e => e.UpdatedAt).HasComment("更新时间");
builder.Property(e => e.IsDeleted).HasDefaultValue(false).HasComment("是否已软删除");
builder.Property(e => e.OperatorIP).HasMaxLength(50).HasComment("操作者IP");
builder.HasIndex(e => e.ExternalSystemId);
}
}