using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using ZB.MOM.WW.ScadaBridge.Commons.Entities.Deployment; using ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances; namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Configurations; public class PendingDeploymentConfiguration : IEntityTypeConfiguration { /// Configures the EF Core mapping for . /// The entity type builder. public void Configure(EntityTypeBuilder builder) { builder.ToTable("PendingDeployments"); builder.HasKey(x => x.Id); builder.Property(x => x.DeploymentId).IsRequired().HasMaxLength(100); builder.HasIndex(x => x.DeploymentId).IsUnique(); builder.HasIndex(x => x.InstanceId); builder.HasIndex(x => x.ExpiresAtUtc); builder.Property(x => x.RevisionHash).IsRequired().HasMaxLength(100); builder.Property(x => x.ConfigurationJson).IsRequired(); // nvarchar(max) builder.Property(x => x.Token).IsRequired().HasMaxLength(128); builder.HasOne().WithMany() .HasForeignKey(x => x.InstanceId) .OnDelete(DeleteBehavior.Cascade); } }