feat(training): add TrainingAngleResult entity and DbSet
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
20
OpenNest.Training/Data/TrainingAngleResult.cs
Normal file
20
OpenNest.Training/Data/TrainingAngleResult.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace OpenNest.Training.Data
|
||||
{
|
||||
[Table("AngleResults")]
|
||||
public class TrainingAngleResult
|
||||
{
|
||||
[Key]
|
||||
public long Id { get; set; }
|
||||
|
||||
public long RunId { get; set; }
|
||||
public double AngleDeg { get; set; }
|
||||
public string Direction { get; set; }
|
||||
public int PartCount { get; set; }
|
||||
|
||||
[ForeignKey(nameof(RunId))]
|
||||
public TrainingRun Run { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ namespace OpenNest.Training.Data
|
||||
{
|
||||
public DbSet<TrainingPart> Parts { get; set; }
|
||||
public DbSet<TrainingRun> Runs { get; set; }
|
||||
public DbSet<TrainingAngleResult> AngleResults { get; set; }
|
||||
|
||||
private readonly string _dbPath;
|
||||
|
||||
@@ -33,6 +34,14 @@ namespace OpenNest.Training.Data
|
||||
.WithMany(p => p.Runs)
|
||||
.HasForeignKey(r => r.PartId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<TrainingAngleResult>(e =>
|
||||
{
|
||||
e.HasIndex(a => a.RunId).HasDatabaseName("idx_angleresults_runid");
|
||||
e.HasOne(a => a.Run)
|
||||
.WithMany(r => r.AngleResults)
|
||||
.HasForeignKey(a => a.RunId);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
@@ -18,8 +19,18 @@ namespace OpenNest.Training.Data
|
||||
public long TimeMs { get; set; }
|
||||
public string LayoutData { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
public string WinnerEngine { get; set; } = "";
|
||||
public long WinnerTimeMs { get; set; }
|
||||
public string RunnerUpEngine { get; set; } = "";
|
||||
public int RunnerUpPartCount { get; set; }
|
||||
public long RunnerUpTimeMs { get; set; }
|
||||
public string ThirdPlaceEngine { get; set; } = "";
|
||||
public int ThirdPlacePartCount { get; set; }
|
||||
public long ThirdPlaceTimeMs { get; set; }
|
||||
|
||||
[ForeignKey(nameof(PartId))]
|
||||
public TrainingPart Part { get; set; }
|
||||
|
||||
public List<TrainingAngleResult> AngleResults { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user