feat(m9/T32a): SharedSchema entity + EF config + idempotent migration + repository

This commit is contained in:
Joseph Doherty
2026-06-18 11:26:48 -04:00
parent 48111b50fd
commit fbe4ddaf58
10 changed files with 2318 additions and 0 deletions
@@ -0,0 +1,32 @@
namespace ZB.MOM.WW.ScadaBridge.Commons.Entities.Schemas;
/// <summary>
/// A reusable, named JSON-Schema library entry (M9 template-level JSON-Schema library,
/// Task T32a). Schemas are referenced from inbound-API / template schema definitions via a
/// <c>{"$ref":"lib:Name"}</c> pointer resolved against this library (the resolver lands in
/// T32b). One row per named schema in the central <c>SharedSchemas</c> MS SQL table.
/// </summary>
/// <remarks>
/// Persistence-ignorant POCO; the EF Core mapping lives in the Configuration Database
/// component (<c>SharedSchemaConfiguration</c>). Mirrors the single-table
/// <see cref="ZB.MOM.WW.ScadaBridge.Commons.Entities.Scripts.SharedScript"/> entity/config/
/// repository shape — surrogate <c>Id</c>, a unique <see cref="Name"/>, and an unbounded
/// text body.
/// </remarks>
public class SharedSchema
{
/// <summary>Primary key.</summary>
public int Id { get; set; }
/// <summary>Unique schema name used to reference this entry (e.g. <c>lib:Name</c>).</summary>
public required string Name { get; set; }
/// <summary>
/// Optional scope discriminator for future namespacing/visibility partitioning;
/// <c>null</c> means an unscoped (global) library entry.
/// </summary>
public string? Scope { get; set; }
/// <summary>The JSON Schema document text.</summary>
public required string SchemaJson { get; set; }
}