Phase 1 WP-1: EF Core DbContext with Fluent API mappings for all 26 entities
ScadaLinkDbContext with 10 configuration classes (Fluent API only), initial migration creating 25 tables, environment-aware migration helper (auto-apply dev, validate-only prod), DesignTimeDbContextFactory, optimistic concurrency on DeploymentRecord. 20 tests verify schema, CRUD, relationships, cascades.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using ScadaLink.Commons.Entities.Scripts;
|
||||
|
||||
namespace ScadaLink.ConfigurationDatabase.Configurations;
|
||||
|
||||
public class SharedScriptConfiguration : IEntityTypeConfiguration<SharedScript>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SharedScript> builder)
|
||||
{
|
||||
builder.HasKey(s => s.Id);
|
||||
|
||||
builder.Property(s => s.Name)
|
||||
.IsRequired()
|
||||
.HasMaxLength(200);
|
||||
|
||||
builder.Property(s => s.Code)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(s => s.ParameterDefinitions)
|
||||
.HasMaxLength(4000);
|
||||
|
||||
builder.Property(s => s.ReturnDefinition)
|
||||
.HasMaxLength(4000);
|
||||
|
||||
builder.HasIndex(s => s.Name).IsUnique();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user