feat(configdb): EF mappings + DbSets for native alarm source entities
This commit is contained in:
+35
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user