refactor: rename ScadaLink → ZB.MOM.WW.ScadaBridge (code + projects + namespaces)

Solution + 23 src projects + 26 test projects renamed; folders, csproj,
namespaces, and ScadaLinkDbContext/ScadaBridgeDbContext class updated.
ActorSystem "scadalink" → "scadabridge", Akka seed-node URLs migrated.
SQL roles/logins, LDAP domains, CLI command name, and CLI config dir
(~/.scadalink → ~/.scadabridge) also renamed.

Build green; 5 Host.Tests fail awaiting SQL login rename in next commit.
Pre-existing StaleTagMonitor timing flakes unchanged.

Rename script committed at tools/rename-to-scadabridge.sh.
This commit is contained in:
Joseph Doherty
2026-05-28 09:37:45 -04:00
parent 6d87ee3c3b
commit 7b0b9c7365
1531 changed files with 11180 additions and 11054 deletions
@@ -0,0 +1,193 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates;
namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Configurations;
public class TemplateConfiguration : IEntityTypeConfiguration<Template>
{
/// <summary>Configures the EF Core mapping for <see cref="Template"/>.</summary>
/// <param name="builder">The entity type builder.</param>
public void Configure(EntityTypeBuilder<Template> builder)
{
builder.HasKey(t => t.Id);
builder.Property(t => t.Name)
.IsRequired()
.HasMaxLength(200);
builder.Property(t => t.Description)
.HasMaxLength(2000);
// Only base (user-authored) templates are globally unique by name.
// Derived templates store their *contained* name (the composition slot's
// InstanceName), unique only within the owner — enforced by the
// (TemplateId, InstanceName) index on TemplateComposition — so they are
// excluded from this index via a filter.
builder.HasIndex(t => t.Name).IsUnique().HasFilter("[IsDerived] = 0");
// Self-referencing parent template (inheritance)
builder.HasOne<Template>()
.WithMany()
.HasForeignKey(t => t.ParentTemplateId)
.OnDelete(DeleteBehavior.Restrict)
.IsRequired(false);
builder.HasOne<TemplateFolder>()
.WithMany()
.HasForeignKey(t => t.FolderId)
.OnDelete(DeleteBehavior.Restrict)
.IsRequired(false);
builder.HasMany(t => t.Attributes)
.WithOne()
.HasForeignKey(a => a.TemplateId)
.OnDelete(DeleteBehavior.Cascade);
builder.HasMany(t => t.Alarms)
.WithOne()
.HasForeignKey(a => a.TemplateId)
.OnDelete(DeleteBehavior.Cascade);
builder.HasMany(t => t.Scripts)
.WithOne()
.HasForeignKey(s => s.TemplateId)
.OnDelete(DeleteBehavior.Cascade);
builder.HasMany(t => t.Compositions)
.WithOne()
.HasForeignKey(c => c.TemplateId)
.OnDelete(DeleteBehavior.Cascade);
}
}
public class TemplateAttributeConfiguration : IEntityTypeConfiguration<TemplateAttribute>
{
/// <summary>Configures the EF Core mapping for <see cref="TemplateAttribute"/>.</summary>
/// <param name="builder">The entity type builder.</param>
public void Configure(EntityTypeBuilder<TemplateAttribute> builder)
{
builder.HasKey(a => a.Id);
builder.Property(a => a.Name)
.IsRequired()
.HasMaxLength(200);
builder.Property(a => a.Value)
.HasMaxLength(4000);
builder.Property(a => a.Description)
.HasMaxLength(2000);
builder.Property(a => a.DataSourceReference)
.HasMaxLength(500);
builder.Property(a => a.DataType)
.HasConversion<string>()
.HasMaxLength(50);
builder.HasIndex(a => new { a.TemplateId, a.Name }).IsUnique();
}
}
public class TemplateAlarmConfiguration : IEntityTypeConfiguration<TemplateAlarm>
{
/// <summary>Configures the EF Core mapping for <see cref="TemplateAlarm"/>.</summary>
/// <param name="builder">The entity type builder.</param>
public void Configure(EntityTypeBuilder<TemplateAlarm> builder)
{
builder.HasKey(a => a.Id);
builder.Property(a => a.Name)
.IsRequired()
.HasMaxLength(200);
builder.Property(a => a.Description)
.HasMaxLength(2000);
builder.Property(a => a.TriggerType)
.HasConversion<string>()
.HasMaxLength(50);
builder.Property(a => a.TriggerConfiguration)
.HasMaxLength(4000);
builder.HasIndex(a => new { a.TemplateId, a.Name }).IsUnique();
}
}
public class TemplateScriptConfiguration : IEntityTypeConfiguration<TemplateScript>
{
/// <summary>Configures the EF Core mapping for <see cref="TemplateScript"/>.</summary>
/// <param name="builder">The entity type builder.</param>
public void Configure(EntityTypeBuilder<TemplateScript> builder)
{
builder.HasKey(s => s.Id);
builder.Property(s => s.Name)
.IsRequired()
.HasMaxLength(200);
builder.Property(s => s.Code)
.IsRequired();
builder.Property(s => s.TriggerType)
.HasMaxLength(50);
builder.Property(s => s.TriggerConfiguration)
.HasMaxLength(4000);
builder.Property(s => s.ParameterDefinitions)
.HasMaxLength(4000);
builder.Property(s => s.ReturnDefinition)
.HasMaxLength(4000);
builder.HasIndex(s => new { s.TemplateId, s.Name }).IsUnique();
}
}
public class TemplateCompositionConfiguration : IEntityTypeConfiguration<TemplateComposition>
{
/// <summary>Configures the EF Core mapping for <see cref="TemplateComposition"/>.</summary>
/// <param name="builder">The entity type builder.</param>
public void Configure(EntityTypeBuilder<TemplateComposition> builder)
{
builder.HasKey(c => c.Id);
builder.Property(c => c.InstanceName)
.IsRequired()
.HasMaxLength(200);
// The composed template reference
builder.HasOne<Template>()
.WithMany()
.HasForeignKey(c => c.ComposedTemplateId)
.OnDelete(DeleteBehavior.Restrict);
builder.HasIndex(c => new { c.TemplateId, c.InstanceName }).IsUnique();
}
}
public class TemplateFolderConfiguration : IEntityTypeConfiguration<TemplateFolder>
{
/// <summary>Configures the EF Core mapping for <see cref="TemplateFolder"/>.</summary>
/// <param name="builder">The entity type builder.</param>
public void Configure(EntityTypeBuilder<TemplateFolder> builder)
{
builder.HasKey(f => f.Id);
builder.Property(f => f.Name)
.IsRequired()
.HasMaxLength(200);
builder.HasOne<TemplateFolder>()
.WithMany()
.HasForeignKey(f => f.ParentFolderId)
.OnDelete(DeleteBehavior.Restrict)
.IsRequired(false);
// Unique sibling name (case-insensitive enforced at service layer; this index is for fast lookup)
builder.HasIndex(f => new { f.ParentFolderId, f.Name }).IsUnique();
}
}