feat(configdb): EF mappings + DbSets for native alarm source entities

This commit is contained in:
Joseph Doherty
2026-05-29 15:52:33 -04:00
parent 913441972e
commit 63f1ec282f
4 changed files with 108 additions and 0 deletions
@@ -58,6 +58,41 @@ public class TemplateConfiguration : IEntityTypeConfiguration<Template>
.WithOne()
.HasForeignKey(c => c.TemplateId)
.OnDelete(DeleteBehavior.Cascade);
builder.HasMany(t => t.NativeAlarmSources)
.WithOne()
.HasForeignKey(s => s.TemplateId)
.OnDelete(DeleteBehavior.Cascade);
}
}
public class TemplateNativeAlarmSourceConfiguration : IEntityTypeConfiguration<TemplateNativeAlarmSource>
{
/// <summary>Configures the EF Core mapping for <see cref="TemplateNativeAlarmSource"/>.</summary>
/// <param name="builder">The entity type builder.</param>
public void Configure(EntityTypeBuilder<TemplateNativeAlarmSource> builder)
{
builder.HasKey(s => s.Id);
builder.Property(s => s.Name)
.IsRequired()
.HasMaxLength(200);
builder.Property(s => s.Description)
.HasMaxLength(2000);
builder.Property(s => s.ConnectionName)
.IsRequired()
.HasMaxLength(200);
builder.Property(s => s.SourceReference)
.IsRequired()
.HasMaxLength(1000);
builder.Property(s => s.ConditionFilter)
.HasMaxLength(1000);
builder.HasIndex(s => new { s.TemplateId, s.Name }).IsUnique();
}
}