Phase 0 WP-0.2–0.9: Implement Commons (types, entities, interfaces, messages, protocol, tests)
- WP-0.2: Namespace/folder skeleton (26 directories) - WP-0.3: Shared data types (6 enums, RetryPolicy, Result<T>) - WP-0.4: 24 domain entity POCOs across 10 domain areas - WP-0.5: 7 repository interfaces with full CRUD signatures - WP-0.6: IAuditService cross-cutting interface - WP-0.7: 26 message contract records across 8 concern areas - WP-0.8: IDataConnection protocol abstraction with batch ops - WP-0.9: 8 architectural constraint enforcement tests All 40 tests pass, zero warnings.
This commit is contained in:
18
src/ScadaLink.Commons/Entities/Templates/Template.cs
Normal file
18
src/ScadaLink.Commons/Entities/Templates/Template.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace ScadaLink.Commons.Entities.Templates;
|
||||
|
||||
public class Template
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public int? ParentTemplateId { get; set; }
|
||||
public ICollection<TemplateAttribute> Attributes { get; set; } = new List<TemplateAttribute>();
|
||||
public ICollection<TemplateAlarm> Alarms { get; set; } = new List<TemplateAlarm>();
|
||||
public ICollection<TemplateScript> Scripts { get; set; } = new List<TemplateScript>();
|
||||
public ICollection<TemplateComposition> Compositions { get; set; } = new List<TemplateComposition>();
|
||||
|
||||
public Template(string name)
|
||||
{
|
||||
Name = name ?? throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
}
|
||||
21
src/ScadaLink.Commons/Entities/Templates/TemplateAlarm.cs
Normal file
21
src/ScadaLink.Commons/Entities/Templates/TemplateAlarm.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using ScadaLink.Commons.Types.Enums;
|
||||
|
||||
namespace ScadaLink.Commons.Entities.Templates;
|
||||
|
||||
public class TemplateAlarm
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int TemplateId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public int PriorityLevel { get; set; }
|
||||
public bool IsLocked { get; set; }
|
||||
public AlarmTriggerType TriggerType { get; set; }
|
||||
public string? TriggerConfiguration { get; set; }
|
||||
public int? OnTriggerScriptId { get; set; }
|
||||
|
||||
public TemplateAlarm(string name)
|
||||
{
|
||||
Name = name ?? throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using ScadaLink.Commons.Types.Enums;
|
||||
|
||||
namespace ScadaLink.Commons.Entities.Templates;
|
||||
|
||||
public class TemplateAttribute
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int TemplateId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string? Value { get; set; }
|
||||
public DataType DataType { get; set; }
|
||||
public bool IsLocked { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public string? DataSourceReference { get; set; }
|
||||
|
||||
public TemplateAttribute(string name)
|
||||
{
|
||||
Name = name ?? throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace ScadaLink.Commons.Entities.Templates;
|
||||
|
||||
public class TemplateComposition
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int TemplateId { get; set; }
|
||||
public int ComposedTemplateId { get; set; }
|
||||
public string InstanceName { get; set; }
|
||||
|
||||
public TemplateComposition(string instanceName)
|
||||
{
|
||||
InstanceName = instanceName ?? throw new ArgumentNullException(nameof(instanceName));
|
||||
}
|
||||
}
|
||||
21
src/ScadaLink.Commons/Entities/Templates/TemplateScript.cs
Normal file
21
src/ScadaLink.Commons/Entities/Templates/TemplateScript.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace ScadaLink.Commons.Entities.Templates;
|
||||
|
||||
public class TemplateScript
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int TemplateId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public bool IsLocked { get; set; }
|
||||
public string Code { get; set; }
|
||||
public string? TriggerType { get; set; }
|
||||
public string? TriggerConfiguration { get; set; }
|
||||
public string? ParameterDefinitions { get; set; }
|
||||
public string? ReturnDefinition { get; set; }
|
||||
public TimeSpan? MinTimeBetweenRuns { get; set; }
|
||||
|
||||
public TemplateScript(string name, string code)
|
||||
{
|
||||
Name = name ?? throw new ArgumentNullException(nameof(name));
|
||||
Code = code ?? throw new ArgumentNullException(nameof(code));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user