diff --git a/GSS2.Core/Analysis/AmineContent/AmineContentCalibrationDataService.cs b/GSS2.Core/Analysis/AmineContent/AmineContentCalibrationDataService.cs index d78c069..f81747e 100644 --- a/GSS2.Core/Analysis/AmineContent/AmineContentCalibrationDataService.cs +++ b/GSS2.Core/Analysis/AmineContent/AmineContentCalibrationDataService.cs @@ -1,4 +1,6 @@ using GSS2.Core.Analysis.AmineContent.Database; +using GSS2.Core.Analysis.AmineContent.Database.Calibration; + using Microsoft.Extensions.Logging; namespace GSS2.Core.Analysis.AmineContent; diff --git a/GSS2.Core/Analysis/AmineContent/AmineContentResultsDataService.cs b/GSS2.Core/Analysis/AmineContent/AmineContentResultsDataService.cs index 7ea58c9..371111f 100644 --- a/GSS2.Core/Analysis/AmineContent/AmineContentResultsDataService.cs +++ b/GSS2.Core/Analysis/AmineContent/AmineContentResultsDataService.cs @@ -1,4 +1,6 @@ using GSS2.Core.Analysis.AmineContent.Database; +using GSS2.Core.Analysis.AmineContent.Database.Calibration; + using Microsoft.Extensions.Logging; namespace GSS2.Core.Analysis.AmineContent; diff --git a/GSS2.Core/Analysis/AmineContent/Database/20251208044919_AmineContentCalibrationInitial.cs b/GSS2.Core/Analysis/AmineContent/Database/20251208044919_AmineContentCalibrationInitial.cs deleted file mode 100644 index ca2fd83..0000000 --- a/GSS2.Core/Analysis/AmineContent/Database/20251208044919_AmineContentCalibrationInitial.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace GSS2.Core.Analysis.AmineContent.Database -{ - /// - public partial class AmineContentCalibrationInitial : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Images", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false, comment: "Уникальный идентификатор") - .Annotation("Sqlite:Autoincrement", true), - VisibleIntensity = table.Column(type: "REAL", nullable: false, comment: "Интенсивность видимого света (0..1)"), - Uv365Intensity = table.Column(type: "REAL", nullable: false, comment: "Интенсивность УФ излучения 365 нм (0..1)"), - Uv254Intensity = table.Column(type: "REAL", nullable: false, comment: "Интенсивность УФ излучения 254 нм (0..1)"), - ImageType = table.Column(type: "TEXT", nullable: false, comment: "Тип изображения (sample - проба или separator - сепаратор)"), - ImagePath = table.Column(type: "TEXT", nullable: false, comment: "Путь к файлу изображения") - }, - constraints: table => - { - table.PrimaryKey("PK_Images", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Records", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false, comment: "Уникальный идентификатор") - .Annotation("Sqlite:Autoincrement", true), - SampleName = table.Column(type: "TEXT", nullable: false, comment: "Название пробы"), - SampleComment = table.Column(type: "TEXT", nullable: false, comment: "Дополнительная информация о пробе"), - SampleBrand = table.Column(type: "TEXT", nullable: false, comment: "Марка пробы"), - SampleMass = table.Column(type: "REAL", nullable: false, comment: "Масса пробы (кг)"), - SamplingDateTime = table.Column(type: "TEXT", nullable: false, comment: "Дата и время отбора пробы"), - SamplingPlace = table.Column(type: "TEXT", nullable: false, comment: "Место отбора пробы"), - MixtureName = table.Column(type: "TEXT", nullable: false, comment: "Название используемой кондиционирующей смеси"), - MixtureAmineContent = table.Column(type: "REAL", nullable: false, comment: "Содержание аминов в кондиционирующей смеси (%)"), - MixtureNormalRate = table.Column(type: "REAL", nullable: false, comment: "Норма расхода кондиционирующей смеси (кг/т)"), - MixtureActualRate = table.Column(type: "REAL", nullable: false, comment: "Истинный расход кондиционирующей смеси (кг/т)"), - AirTemperature = table.Column(type: "REAL", nullable: false, comment: "Температура воздуха (℃)"), - AirHumidity = table.Column(type: "REAL", nullable: false, comment: "Относительная влажность воздуха (%)") - }, - constraints: table => - { - table.PrimaryKey("PK_Records", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "SampleImages", - columns: table => new - { - SampleImagesId = table.Column(type: "INTEGER", nullable: false), - SampleRecordsId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_SampleImages", x => new { x.SampleImagesId, x.SampleRecordsId }); - table.ForeignKey( - name: "FK_SampleImages_Images_SampleImagesId", - column: x => x.SampleImagesId, - principalTable: "Images", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_SampleImages_Records_SampleRecordsId", - column: x => x.SampleRecordsId, - principalTable: "Records", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "SeparatorImages", - columns: table => new - { - SeparatorImagesId = table.Column(type: "INTEGER", nullable: false), - SeparatorRecordsId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_SeparatorImages", x => new { x.SeparatorImagesId, x.SeparatorRecordsId }); - table.ForeignKey( - name: "FK_SeparatorImages_Images_SeparatorImagesId", - column: x => x.SeparatorImagesId, - principalTable: "Images", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_SeparatorImages_Records_SeparatorRecordsId", - column: x => x.SeparatorRecordsId, - principalTable: "Records", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_SampleImages_SampleRecordsId", - table: "SampleImages", - column: "SampleRecordsId"); - - migrationBuilder.CreateIndex( - name: "IX_SeparatorImages_SeparatorRecordsId", - table: "SeparatorImages", - column: "SeparatorRecordsId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "SampleImages"); - - migrationBuilder.DropTable( - name: "SeparatorImages"); - - migrationBuilder.DropTable( - name: "Images"); - - migrationBuilder.DropTable( - name: "Records"); - } - } -} diff --git a/GSS2.Core/Analysis/AmineContent/Database/AmineContentCalibrationContext.cs b/GSS2.Core/Analysis/AmineContent/Database/AmineContentCalibrationContext.cs deleted file mode 100644 index be5da75..0000000 --- a/GSS2.Core/Analysis/AmineContent/Database/AmineContentCalibrationContext.cs +++ /dev/null @@ -1,78 +0,0 @@ -using Microsoft.EntityFrameworkCore; - -namespace GSS2.Core.Analysis.AmineContent.Database; - -public class AmineContentCalibrationContext : DbContext -{ - public class Record - { - [Comment("Уникальный идентификатор")] - public int Id { get; set; } - [Comment("Название пробы")] - public string SampleName { get; set; } = string.Empty; - [Comment("Дополнительная информация о пробе")] - public string SampleComment { get; set; } = string.Empty; - [Comment("Марка пробы")] - public string SampleBrand { get; set; } = string.Empty; - [Comment("Масса пробы (кг)")] - public double SampleMass { get; set; } = double.NaN; - [Comment("Дата и время отбора пробы")] - public DateTime SamplingDateTime { get; set; } = DateTime.Now; - [Comment("Место отбора пробы")] - public string SamplingPlace { get; set; } = string.Empty; - [Comment("Название используемой кондиционирующей смеси")] - public string MixtureName { get; set; } = string.Empty; - [Comment("Содержание аминов в кондиционирующей смеси (%)")] - public double MixtureAmineContent { get; set; } = double.NaN; - [Comment("Норма расхода кондиционирующей смеси (кг/т)")] - public double MixtureNormalRate { get; set; } = double.NaN; - [Comment("Истинный расход кондиционирующей смеси (кг/т)")] - public double MixtureActualRate { get; set; } = double.NaN; - [Comment("Изображения пробы")] - public List SampleImages { get; set; } = new(); - [Comment("Изображения пустого сепаратора")] - public List SeparatorImages { get; set; } = new(); - [Comment("Температура воздуха (℃)")] - public double AirTemperature { get; set; } = new(); - [Comment("Относительная влажность воздуха (%)")] - public double AirHumidity { get; set; } = new(); - } - public class ImageData - { - [Comment("Уникальный идентификатор")] - public int Id { get; set; } - [Comment("Интенсивность видимого света (0..1)")] - public double VisibleIntensity { get; set; } = double.NaN; - [Comment("Интенсивность УФ излучения 365 нм (0..1)")] - public double Uv365Intensity { get; set; } = double.NaN; - [Comment("Интенсивность УФ излучения 254 нм (0..1)")] - public double Uv254Intensity { get; set; } = double.NaN; - [Comment("Тип изображения (sample - проба или separator - сепаратор)")] - public string ImageType { get; set; } = string.Empty; - [Comment("Путь к файлу изображения")] - public string ImagePath { get; set; } = string.Empty; - - [Comment("Записи в которых это изображение используется как изображение пробы")] - public List SampleRecords { get; set; } = new(); - [Comment("Записи в которых это изображение используется как изображение сепаратора")] - public List SeparatorRecords { get; set; } = new(); - } - - public DbSet Records => Set(); - public DbSet Images => Set(); - - public AmineContentCalibrationContext(DbContextOptions options) : base(options) { } - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity() - .HasMany(r => r.SampleImages) - .WithMany(i => i.SampleRecords) - .UsingEntity(j => j.ToTable("SampleImages")); - - modelBuilder.Entity() - .HasMany(r => r.SeparatorImages) - .WithMany(i => i.SeparatorRecords) - .UsingEntity(j => j.ToTable("SeparatorImages")); - } -} \ No newline at end of file diff --git a/GSS2.Core/Analysis/AmineContent/Database/20251208044919_AmineContentCalibrationInitial.Designer.cs b/GSS2.Core/Analysis/AmineContent/Database/Calibration/20260227055810_AmineContentCalibrationInitial.Designer.cs similarity index 51% rename from GSS2.Core/Analysis/AmineContent/Database/20251208044919_AmineContentCalibrationInitial.Designer.cs rename to GSS2.Core/Analysis/AmineContent/Database/Calibration/20260227055810_AmineContentCalibrationInitial.Designer.cs index 053ce41..5bf9793 100644 --- a/GSS2.Core/Analysis/AmineContent/Database/20251208044919_AmineContentCalibrationInitial.Designer.cs +++ b/GSS2.Core/Analysis/AmineContent/Database/Calibration/20260227055810_AmineContentCalibrationInitial.Designer.cs @@ -1,6 +1,6 @@ // using System; -using GSS2.Core.Analysis.AmineContent.Database; +using GSS2.Core.Analysis.AmineContent.Database.Calibration; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; @@ -8,10 +8,10 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; #nullable disable -namespace GSS2.Core.Analysis.AmineContent.Database +namespace GSS2.Core.Analysis.AmineContent.Database.Calibration { [DbContext(typeof(AmineContentCalibrationContext))] - [Migration("20251208044919_AmineContentCalibrationInitial")] + [Migration("20260227055810_AmineContentCalibrationInitial")] partial class AmineContentCalibrationInitial { /// @@ -20,22 +20,87 @@ namespace GSS2.Core.Analysis.AmineContent.Database #pragma warning disable 612, 618 modelBuilder.HasAnnotation("ProductVersion", "10.0.0"); - modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.AmineContentCalibrationContext+ImageData", b => + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.CalibrationRecord", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("INTEGER") .HasComment("Уникальный идентификатор"); + b.Property("MixtureActualRate") + .HasColumnType("REAL") + .HasComment("Фактический расход кондиционирующей смеси (кг/т)"); + + b.Property("MixtureAmineContent") + .HasColumnType("REAL") + .HasComment("Содержание аминов в кондиционирующей смеси (%)"); + + b.Property("MixtureName") + .HasMaxLength(512) + .HasColumnType("TEXT") + .HasComment("Название используемой кондиционирующей смеси"); + + b.Property("MixtureNormalRate") + .HasColumnType("REAL") + .HasComment("Норма расхода кондиционирующей смеси (кг/т)"); + + b.Property("SampleBrand") + .HasMaxLength(512) + .HasColumnType("TEXT") + .HasComment("Марка пробы"); + + b.Property("SampleComment") + .HasMaxLength(2048) + .HasColumnType("TEXT") + .HasComment("Дополнительная информация о пробе"); + + b.Property("SampleMass") + .HasColumnType("REAL") + .HasComment("Масса пробы (кг)"); + + b.Property("SampleName") + .HasMaxLength(512) + .HasColumnType("TEXT") + .HasComment("Название пробы"); + + b.Property("SamplingDateTime") + .HasColumnType("TEXT") + .HasComment("Дата и время отбора пробы"); + + b.Property("SamplingPlace") + .HasMaxLength(512) + .HasColumnType("TEXT") + .HasComment("Место отбора пробы"); + + b.HasKey("Id"); + + b.ToTable("CalibrationRecords"); + }); + + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.ImageRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasComment("Уникальный идентификатор"); + + b.Property("CalibrationRecordId") + .HasColumnType("INTEGER"); + + b.Property("CalibrationRecordId1") + .HasColumnType("INTEGER"); + b.Property("ImagePath") .IsRequired() + .HasMaxLength(1024) .HasColumnType("TEXT") .HasComment("Путь к файлу изображения"); - b.Property("ImageType") - .IsRequired() - .HasColumnType("TEXT") - .HasComment("Тип изображения (sample - проба или separator - сепаратор)"); + b.Property("SeparatorRecordId") + .HasColumnType("INTEGER"); + + b.Property("TrayRecordId") + .HasColumnType("INTEGER"); b.Property("Uv254Intensity") .HasColumnType("REAL") @@ -51,132 +116,91 @@ namespace GSS2.Core.Analysis.AmineContent.Database b.HasKey("Id"); - b.ToTable("Images"); + b.HasIndex("CalibrationRecordId"); + + b.HasIndex("CalibrationRecordId1"); + + b.HasIndex("SeparatorRecordId"); + + b.HasIndex("TrayRecordId"); + + b.ToTable("ImageRecords"); }); - modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.AmineContentCalibrationContext+Record", b => + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.SeparatorRecord", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("INTEGER") .HasComment("Уникальный идентификатор"); - b.Property("AirHumidity") - .HasColumnType("REAL") - .HasComment("Относительная влажность воздуха (%)"); - - b.Property("AirTemperature") - .HasColumnType("REAL") - .HasComment("Температура воздуха (℃)"); - - b.Property("MixtureActualRate") - .HasColumnType("REAL") - .HasComment("Истинный расход кондиционирующей смеси (кг/т)"); - - b.Property("MixtureAmineContent") - .HasColumnType("REAL") - .HasComment("Содержание аминов в кондиционирующей смеси (%)"); - - b.Property("MixtureName") + b.Property("Batch") .IsRequired() + .HasMaxLength(256) .HasColumnType("TEXT") - .HasComment("Название используемой кондиционирующей смеси"); + .HasComment("Партия сепаратора"); - b.Property("MixtureNormalRate") - .HasColumnType("REAL") - .HasComment("Норма расхода кондиционирующей смеси (кг/т)"); - - b.Property("SampleBrand") + b.Property("Type") .IsRequired() + .HasMaxLength(256) .HasColumnType("TEXT") - .HasComment("Марка пробы"); - - b.Property("SampleComment") - .IsRequired() - .HasColumnType("TEXT") - .HasComment("Дополнительная информация о пробе"); - - b.Property("SampleMass") - .HasColumnType("REAL") - .HasComment("Масса пробы (кг)"); - - b.Property("SampleName") - .IsRequired() - .HasColumnType("TEXT") - .HasComment("Название пробы"); - - b.Property("SamplingDateTime") - .HasColumnType("TEXT") - .HasComment("Дата и время отбора пробы"); - - b.Property("SamplingPlace") - .IsRequired() - .HasColumnType("TEXT") - .HasComment("Место отбора пробы"); + .HasComment("Тип сепаратора"); b.HasKey("Id"); - b.ToTable("Records"); + b.ToTable("SeparatorRecords"); }); - modelBuilder.Entity("ImageDataRecord", b => + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.TrayRecord", b => { - b.Property("SampleImagesId") - .HasColumnType("INTEGER"); + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasComment("Уникальный идентификатор"); - b.Property("SampleRecordsId") - .HasColumnType("INTEGER"); + b.HasKey("Id"); - b.HasKey("SampleImagesId", "SampleRecordsId"); - - b.HasIndex("SampleRecordsId"); - - b.ToTable("SampleImages", (string)null); + b.ToTable("TrayRecords"); }); - modelBuilder.Entity("ImageDataRecord1", b => + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.ImageRecord", b => { - b.Property("SeparatorImagesId") - .HasColumnType("INTEGER"); + b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Calibration.CalibrationRecord", null) + .WithMany("SampleImages") + .HasForeignKey("CalibrationRecordId") + .OnDelete(DeleteBehavior.Cascade); - b.Property("SeparatorRecordsId") - .HasColumnType("INTEGER"); + b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Calibration.CalibrationRecord", null) + .WithMany("SeparatorImages") + .HasForeignKey("CalibrationRecordId1") + .OnDelete(DeleteBehavior.Cascade); - b.HasKey("SeparatorImagesId", "SeparatorRecordsId"); + b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Calibration.SeparatorRecord", null) + .WithMany("Images") + .HasForeignKey("SeparatorRecordId") + .OnDelete(DeleteBehavior.Cascade); - b.HasIndex("SeparatorRecordsId"); - - b.ToTable("SeparatorImages", (string)null); + b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Calibration.TrayRecord", null) + .WithMany("Images") + .HasForeignKey("TrayRecordId") + .OnDelete(DeleteBehavior.Cascade); }); - modelBuilder.Entity("ImageDataRecord", b => + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.CalibrationRecord", b => { - b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentCalibrationContext+ImageData", null) - .WithMany() - .HasForeignKey("SampleImagesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + b.Navigation("SampleImages"); - b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentCalibrationContext+Record", null) - .WithMany() - .HasForeignKey("SampleRecordsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + b.Navigation("SeparatorImages"); }); - modelBuilder.Entity("ImageDataRecord1", b => + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.SeparatorRecord", b => { - b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentCalibrationContext+ImageData", null) - .WithMany() - .HasForeignKey("SeparatorImagesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + b.Navigation("Images"); + }); - b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentCalibrationContext+Record", null) - .WithMany() - .HasForeignKey("SeparatorRecordsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.TrayRecord", b => + { + b.Navigation("Images"); }); #pragma warning restore 612, 618 } diff --git a/GSS2.Core/Analysis/AmineContent/Database/Calibration/20260227055810_AmineContentCalibrationInitial.cs b/GSS2.Core/Analysis/AmineContent/Database/Calibration/20260227055810_AmineContentCalibrationInitial.cs new file mode 100644 index 0000000..1baa25e --- /dev/null +++ b/GSS2.Core/Analysis/AmineContent/Database/Calibration/20260227055810_AmineContentCalibrationInitial.cs @@ -0,0 +1,143 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace GSS2.Core.Analysis.AmineContent.Database.Calibration +{ + /// + public partial class AmineContentCalibrationInitial : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "CalibrationRecords", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false, comment: "Уникальный идентификатор") + .Annotation("Sqlite:Autoincrement", true), + SampleName = table.Column(type: "TEXT", maxLength: 512, nullable: true, comment: "Название пробы"), + SampleComment = table.Column(type: "TEXT", maxLength: 2048, nullable: true, comment: "Дополнительная информация о пробе"), + SampleBrand = table.Column(type: "TEXT", maxLength: 512, nullable: true, comment: "Марка пробы"), + SampleMass = table.Column(type: "REAL", nullable: true, comment: "Масса пробы (кг)"), + SamplingDateTime = table.Column(type: "TEXT", nullable: true, comment: "Дата и время отбора пробы"), + SamplingPlace = table.Column(type: "TEXT", maxLength: 512, nullable: true, comment: "Место отбора пробы"), + MixtureName = table.Column(type: "TEXT", maxLength: 512, nullable: true, comment: "Название используемой кондиционирующей смеси"), + MixtureAmineContent = table.Column(type: "REAL", nullable: true, comment: "Содержание аминов в кондиционирующей смеси (%)"), + MixtureNormalRate = table.Column(type: "REAL", nullable: true, comment: "Норма расхода кондиционирующей смеси (кг/т)"), + MixtureActualRate = table.Column(type: "REAL", nullable: true, comment: "Фактический расход кондиционирующей смеси (кг/т)") + }, + constraints: table => + { + table.PrimaryKey("PK_CalibrationRecords", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "SeparatorRecords", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false, comment: "Уникальный идентификатор") + .Annotation("Sqlite:Autoincrement", true), + Type = table.Column(type: "TEXT", maxLength: 256, nullable: false, comment: "Тип сепаратора"), + Batch = table.Column(type: "TEXT", maxLength: 256, nullable: false, comment: "Партия сепаратора") + }, + constraints: table => + { + table.PrimaryKey("PK_SeparatorRecords", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "TrayRecords", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false, comment: "Уникальный идентификатор") + .Annotation("Sqlite:Autoincrement", true) + }, + constraints: table => + { + table.PrimaryKey("PK_TrayRecords", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ImageRecords", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false, comment: "Уникальный идентификатор") + .Annotation("Sqlite:Autoincrement", true), + VisibleIntensity = table.Column(type: "REAL", nullable: false, comment: "Интенсивность видимого света (0..1)"), + Uv365Intensity = table.Column(type: "REAL", nullable: false, comment: "Интенсивность УФ излучения 365 нм (0..1)"), + Uv254Intensity = table.Column(type: "REAL", nullable: false, comment: "Интенсивность УФ излучения 254 нм (0..1)"), + ImagePath = table.Column(type: "TEXT", maxLength: 1024, nullable: false, comment: "Путь к файлу изображения"), + CalibrationRecordId = table.Column(type: "INTEGER", nullable: true), + CalibrationRecordId1 = table.Column(type: "INTEGER", nullable: true), + SeparatorRecordId = table.Column(type: "INTEGER", nullable: true), + TrayRecordId = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ImageRecords", x => x.Id); + table.ForeignKey( + name: "FK_ImageRecords_CalibrationRecords_CalibrationRecordId", + column: x => x.CalibrationRecordId, + principalTable: "CalibrationRecords", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ImageRecords_CalibrationRecords_CalibrationRecordId1", + column: x => x.CalibrationRecordId1, + principalTable: "CalibrationRecords", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ImageRecords_SeparatorRecords_SeparatorRecordId", + column: x => x.SeparatorRecordId, + principalTable: "SeparatorRecords", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ImageRecords_TrayRecords_TrayRecordId", + column: x => x.TrayRecordId, + principalTable: "TrayRecords", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_ImageRecords_CalibrationRecordId", + table: "ImageRecords", + column: "CalibrationRecordId"); + + migrationBuilder.CreateIndex( + name: "IX_ImageRecords_CalibrationRecordId1", + table: "ImageRecords", + column: "CalibrationRecordId1"); + + migrationBuilder.CreateIndex( + name: "IX_ImageRecords_SeparatorRecordId", + table: "ImageRecords", + column: "SeparatorRecordId"); + + migrationBuilder.CreateIndex( + name: "IX_ImageRecords_TrayRecordId", + table: "ImageRecords", + column: "TrayRecordId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ImageRecords"); + + migrationBuilder.DropTable( + name: "CalibrationRecords"); + + migrationBuilder.DropTable( + name: "SeparatorRecords"); + + migrationBuilder.DropTable( + name: "TrayRecords"); + } + } +} diff --git a/GSS2.Core/Analysis/AmineContent/Database/Calibration/AmineContentCalibrationContext.cs b/GSS2.Core/Analysis/AmineContent/Database/Calibration/AmineContentCalibrationContext.cs new file mode 100644 index 0000000..403fcca --- /dev/null +++ b/GSS2.Core/Analysis/AmineContent/Database/Calibration/AmineContentCalibrationContext.cs @@ -0,0 +1,75 @@ +using Microsoft.EntityFrameworkCore; + +namespace GSS2.Core.Analysis.AmineContent.Database.Calibration; + +public class AmineContentCalibrationContext : DbContext +{ + + public DbSet ImageRecords => Set(); + public DbSet TrayRecords => Set(); + public DbSet SeparatorRecords => Set(); + public DbSet CalibrationRecords => Set(); + + public AmineContentCalibrationContext(DbContextOptions options) + : base(options) + { } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + + modelBuilder.Entity(entity => + { + entity.HasKey(x => x.Id); + + entity.Property(x => x.ImagePath) + .IsRequired() + .HasMaxLength(1024); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(x => x.Id); + + entity.HasMany(x => x.Images) + .WithOne() + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(x => x.Id); + + entity.Property(x => x.Type) + .IsRequired() + .HasMaxLength(256); + + entity.Property(x => x.Batch) + .IsRequired() + .HasMaxLength(256); + + entity.HasMany(x => x.Images) + .WithOne() + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(x => x.Id); + + entity.Property(x => x.SampleName).HasMaxLength(512); + entity.Property(x => x.SampleComment).HasMaxLength(2048); + entity.Property(x => x.SampleBrand).HasMaxLength(512); + entity.Property(x => x.SamplingPlace).HasMaxLength(512); + entity.Property(x => x.MixtureName).HasMaxLength(512); + + entity.HasMany(x => x.SampleImages) + .WithOne() + .OnDelete(DeleteBehavior.Cascade); + + entity.HasMany(x => x.SeparatorImages) + .WithOne() + .OnDelete(DeleteBehavior.Cascade); + }); + } +} \ No newline at end of file diff --git a/GSS2.Core/Analysis/AmineContent/Database/AmineContentCalibrationContextFactory.cs b/GSS2.Core/Analysis/AmineContent/Database/Calibration/AmineContentCalibrationContextFactory.cs similarity index 91% rename from GSS2.Core/Analysis/AmineContent/Database/AmineContentCalibrationContextFactory.cs rename to GSS2.Core/Analysis/AmineContent/Database/Calibration/AmineContentCalibrationContextFactory.cs index 95d0588..2961a9b 100644 --- a/GSS2.Core/Analysis/AmineContent/Database/AmineContentCalibrationContextFactory.cs +++ b/GSS2.Core/Analysis/AmineContent/Database/Calibration/AmineContentCalibrationContextFactory.cs @@ -1,7 +1,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; -namespace GSS2.Core.Analysis.AmineContent.Database; +namespace GSS2.Core.Analysis.AmineContent.Database.Calibration; public class AmineContentCalibrationContextFactory : IDesignTimeDbContextFactory { diff --git a/GSS2.Core/Analysis/AmineContent/Database/AmineContentCalibrationContextModelSnapshot.cs b/GSS2.Core/Analysis/AmineContent/Database/Calibration/AmineContentCalibrationContextModelSnapshot.cs similarity index 51% rename from GSS2.Core/Analysis/AmineContent/Database/AmineContentCalibrationContextModelSnapshot.cs rename to GSS2.Core/Analysis/AmineContent/Database/Calibration/AmineContentCalibrationContextModelSnapshot.cs index 79130e7..7173855 100644 --- a/GSS2.Core/Analysis/AmineContent/Database/AmineContentCalibrationContextModelSnapshot.cs +++ b/GSS2.Core/Analysis/AmineContent/Database/Calibration/AmineContentCalibrationContextModelSnapshot.cs @@ -1,13 +1,13 @@ // using System; -using GSS2.Core.Analysis.AmineContent.Database; +using GSS2.Core.Analysis.AmineContent.Database.Calibration; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; #nullable disable -namespace GSS2.Core.Analysis.AmineContent.Database +namespace GSS2.Core.Analysis.AmineContent.Database.Calibration { [DbContext(typeof(AmineContentCalibrationContext))] partial class AmineContentCalibrationContextModelSnapshot : ModelSnapshot @@ -17,22 +17,87 @@ namespace GSS2.Core.Analysis.AmineContent.Database #pragma warning disable 612, 618 modelBuilder.HasAnnotation("ProductVersion", "10.0.0"); - modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.AmineContentCalibrationContext+ImageData", b => + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.CalibrationRecord", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("INTEGER") .HasComment("Уникальный идентификатор"); + b.Property("MixtureActualRate") + .HasColumnType("REAL") + .HasComment("Фактический расход кондиционирующей смеси (кг/т)"); + + b.Property("MixtureAmineContent") + .HasColumnType("REAL") + .HasComment("Содержание аминов в кондиционирующей смеси (%)"); + + b.Property("MixtureName") + .HasMaxLength(512) + .HasColumnType("TEXT") + .HasComment("Название используемой кондиционирующей смеси"); + + b.Property("MixtureNormalRate") + .HasColumnType("REAL") + .HasComment("Норма расхода кондиционирующей смеси (кг/т)"); + + b.Property("SampleBrand") + .HasMaxLength(512) + .HasColumnType("TEXT") + .HasComment("Марка пробы"); + + b.Property("SampleComment") + .HasMaxLength(2048) + .HasColumnType("TEXT") + .HasComment("Дополнительная информация о пробе"); + + b.Property("SampleMass") + .HasColumnType("REAL") + .HasComment("Масса пробы (кг)"); + + b.Property("SampleName") + .HasMaxLength(512) + .HasColumnType("TEXT") + .HasComment("Название пробы"); + + b.Property("SamplingDateTime") + .HasColumnType("TEXT") + .HasComment("Дата и время отбора пробы"); + + b.Property("SamplingPlace") + .HasMaxLength(512) + .HasColumnType("TEXT") + .HasComment("Место отбора пробы"); + + b.HasKey("Id"); + + b.ToTable("CalibrationRecords"); + }); + + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.ImageRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasComment("Уникальный идентификатор"); + + b.Property("CalibrationRecordId") + .HasColumnType("INTEGER"); + + b.Property("CalibrationRecordId1") + .HasColumnType("INTEGER"); + b.Property("ImagePath") .IsRequired() + .HasMaxLength(1024) .HasColumnType("TEXT") .HasComment("Путь к файлу изображения"); - b.Property("ImageType") - .IsRequired() - .HasColumnType("TEXT") - .HasComment("Тип изображения (sample - проба или separator - сепаратор)"); + b.Property("SeparatorRecordId") + .HasColumnType("INTEGER"); + + b.Property("TrayRecordId") + .HasColumnType("INTEGER"); b.Property("Uv254Intensity") .HasColumnType("REAL") @@ -48,132 +113,91 @@ namespace GSS2.Core.Analysis.AmineContent.Database b.HasKey("Id"); - b.ToTable("Images"); + b.HasIndex("CalibrationRecordId"); + + b.HasIndex("CalibrationRecordId1"); + + b.HasIndex("SeparatorRecordId"); + + b.HasIndex("TrayRecordId"); + + b.ToTable("ImageRecords"); }); - modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.AmineContentCalibrationContext+Record", b => + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.SeparatorRecord", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("INTEGER") .HasComment("Уникальный идентификатор"); - b.Property("AirHumidity") - .HasColumnType("REAL") - .HasComment("Относительная влажность воздуха (%)"); - - b.Property("AirTemperature") - .HasColumnType("REAL") - .HasComment("Температура воздуха (℃)"); - - b.Property("MixtureActualRate") - .HasColumnType("REAL") - .HasComment("Истинный расход кондиционирующей смеси (кг/т)"); - - b.Property("MixtureAmineContent") - .HasColumnType("REAL") - .HasComment("Содержание аминов в кондиционирующей смеси (%)"); - - b.Property("MixtureName") + b.Property("Batch") .IsRequired() + .HasMaxLength(256) .HasColumnType("TEXT") - .HasComment("Название используемой кондиционирующей смеси"); + .HasComment("Партия сепаратора"); - b.Property("MixtureNormalRate") - .HasColumnType("REAL") - .HasComment("Норма расхода кондиционирующей смеси (кг/т)"); - - b.Property("SampleBrand") + b.Property("Type") .IsRequired() + .HasMaxLength(256) .HasColumnType("TEXT") - .HasComment("Марка пробы"); - - b.Property("SampleComment") - .IsRequired() - .HasColumnType("TEXT") - .HasComment("Дополнительная информация о пробе"); - - b.Property("SampleMass") - .HasColumnType("REAL") - .HasComment("Масса пробы (кг)"); - - b.Property("SampleName") - .IsRequired() - .HasColumnType("TEXT") - .HasComment("Название пробы"); - - b.Property("SamplingDateTime") - .HasColumnType("TEXT") - .HasComment("Дата и время отбора пробы"); - - b.Property("SamplingPlace") - .IsRequired() - .HasColumnType("TEXT") - .HasComment("Место отбора пробы"); + .HasComment("Тип сепаратора"); b.HasKey("Id"); - b.ToTable("Records"); + b.ToTable("SeparatorRecords"); }); - modelBuilder.Entity("ImageDataRecord", b => + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.TrayRecord", b => { - b.Property("SampleImagesId") - .HasColumnType("INTEGER"); + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasComment("Уникальный идентификатор"); - b.Property("SampleRecordsId") - .HasColumnType("INTEGER"); + b.HasKey("Id"); - b.HasKey("SampleImagesId", "SampleRecordsId"); - - b.HasIndex("SampleRecordsId"); - - b.ToTable("SampleImages", (string)null); + b.ToTable("TrayRecords"); }); - modelBuilder.Entity("ImageDataRecord1", b => + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.ImageRecord", b => { - b.Property("SeparatorImagesId") - .HasColumnType("INTEGER"); + b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Calibration.CalibrationRecord", null) + .WithMany("SampleImages") + .HasForeignKey("CalibrationRecordId") + .OnDelete(DeleteBehavior.Cascade); - b.Property("SeparatorRecordsId") - .HasColumnType("INTEGER"); + b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Calibration.CalibrationRecord", null) + .WithMany("SeparatorImages") + .HasForeignKey("CalibrationRecordId1") + .OnDelete(DeleteBehavior.Cascade); - b.HasKey("SeparatorImagesId", "SeparatorRecordsId"); + b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Calibration.SeparatorRecord", null) + .WithMany("Images") + .HasForeignKey("SeparatorRecordId") + .OnDelete(DeleteBehavior.Cascade); - b.HasIndex("SeparatorRecordsId"); - - b.ToTable("SeparatorImages", (string)null); + b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Calibration.TrayRecord", null) + .WithMany("Images") + .HasForeignKey("TrayRecordId") + .OnDelete(DeleteBehavior.Cascade); }); - modelBuilder.Entity("ImageDataRecord", b => + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.CalibrationRecord", b => { - b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentCalibrationContext+ImageData", null) - .WithMany() - .HasForeignKey("SampleImagesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + b.Navigation("SampleImages"); - b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentCalibrationContext+Record", null) - .WithMany() - .HasForeignKey("SampleRecordsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + b.Navigation("SeparatorImages"); }); - modelBuilder.Entity("ImageDataRecord1", b => + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.SeparatorRecord", b => { - b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentCalibrationContext+ImageData", null) - .WithMany() - .HasForeignKey("SeparatorImagesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + b.Navigation("Images"); + }); - b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentCalibrationContext+Record", null) - .WithMany() - .HasForeignKey("SeparatorRecordsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.TrayRecord", b => + { + b.Navigation("Images"); }); #pragma warning restore 612, 618 } diff --git a/GSS2.Core/Analysis/AmineContent/Database/Calibration/CalibrationRecord.cs b/GSS2.Core/Analysis/AmineContent/Database/Calibration/CalibrationRecord.cs new file mode 100644 index 0000000..2420366 --- /dev/null +++ b/GSS2.Core/Analysis/AmineContent/Database/Calibration/CalibrationRecord.cs @@ -0,0 +1,33 @@ +using Microsoft.EntityFrameworkCore; + +namespace GSS2.Core.Analysis.AmineContent.Database.Calibration; + +public record CalibrationRecord +{ + [Comment("Уникальный идентификатор")] + public int Id { get; set; } + [Comment("Название пробы")] + public required string? SampleName { get; init; } + [Comment("Дополнительная информация о пробе")] + public required string? SampleComment { get; init; } + [Comment("Марка пробы")] + public required string? SampleBrand { get; init; } + [Comment("Масса пробы (кг)")] + public required double? SampleMass { get; init; } + [Comment("Дата и время отбора пробы")] + public required DateTime? SamplingDateTime { get; init; } + [Comment("Место отбора пробы")] + public required string? SamplingPlace { get; init; } + [Comment("Название используемой кондиционирующей смеси")] + public required string? MixtureName { get; init; } + [Comment("Содержание аминов в кондиционирующей смеси (%)")] + public required double? MixtureAmineContent { get; init; } + [Comment("Норма расхода кондиционирующей смеси (кг/т)")] + public required double? MixtureNormalRate { get; init; } + [Comment("Фактический расход кондиционирующей смеси (кг/т)")] + public required double? MixtureActualRate { get; init; } + [Comment("Изображения пробы")] + public required List SampleImages { get; init; } + [Comment("Изображения пустого сепаратора")] + public required List SeparatorImages { get; init; } +} diff --git a/GSS2.Core/Analysis/AmineContent/Database/Calibration/ImageRecord.cs b/GSS2.Core/Analysis/AmineContent/Database/Calibration/ImageRecord.cs new file mode 100644 index 0000000..c4357a5 --- /dev/null +++ b/GSS2.Core/Analysis/AmineContent/Database/Calibration/ImageRecord.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore; + +namespace GSS2.Core.Analysis.AmineContent.Database.Calibration; + +public record ImageRecord +{ + [Comment("Уникальный идентификатор")] + public int Id { get; set; } + [Comment("Интенсивность видимого света (0..1)")] + public required double VisibleIntensity { get; init; } + [Comment("Интенсивность УФ излучения 365 нм (0..1)")] + public required double Uv365Intensity { get; init; } + [Comment("Интенсивность УФ излучения 254 нм (0..1)")] + public required double Uv254Intensity { get; init; } + [Comment("Путь к файлу изображения")] + public required string ImagePath { get; init; } +} diff --git a/GSS2.Core/Analysis/AmineContent/Database/Calibration/SeparatorRecord.cs b/GSS2.Core/Analysis/AmineContent/Database/Calibration/SeparatorRecord.cs new file mode 100644 index 0000000..302620b --- /dev/null +++ b/GSS2.Core/Analysis/AmineContent/Database/Calibration/SeparatorRecord.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; + +namespace GSS2.Core.Analysis.AmineContent.Database.Calibration; + +public record SeparatorRecord +{ + [Comment("Уникальный идентификатор")] + public int Id { get; set; } + [Comment("Тип сепаратора")] + public required string Type { get; init; } + [Comment("Партия сепаратора")] + public required string Batch { get; init; } + [Comment("Изображения сепаратора")] + public required List Images { get; init; } +} diff --git a/GSS2.Core/Analysis/AmineContent/Database/Calibration/TrayRecord.cs b/GSS2.Core/Analysis/AmineContent/Database/Calibration/TrayRecord.cs new file mode 100644 index 0000000..6ffc854 --- /dev/null +++ b/GSS2.Core/Analysis/AmineContent/Database/Calibration/TrayRecord.cs @@ -0,0 +1,11 @@ +using Microsoft.EntityFrameworkCore; + +namespace GSS2.Core.Analysis.AmineContent.Database.Calibration; + +public record TrayRecord +{ + [Comment("Уникальный идентификатор")] + public int Id { get; set; } + [Comment("Изображения лотка")] + public required List Images { get; init; } +} diff --git a/GSS2.Core/Analysis/AmineContent/Database/20251208044924_AmineContentResultsInitial.Designer.cs b/GSS2.Core/Analysis/AmineContent/Database/Results/20260227055822_AmineContentResultsInitial.Designer.cs similarity index 92% rename from GSS2.Core/Analysis/AmineContent/Database/20251208044924_AmineContentResultsInitial.Designer.cs rename to GSS2.Core/Analysis/AmineContent/Database/Results/20260227055822_AmineContentResultsInitial.Designer.cs index df543f1..41f8de9 100644 --- a/GSS2.Core/Analysis/AmineContent/Database/20251208044924_AmineContentResultsInitial.Designer.cs +++ b/GSS2.Core/Analysis/AmineContent/Database/Results/20260227055822_AmineContentResultsInitial.Designer.cs @@ -1,6 +1,6 @@ // using System; -using GSS2.Core.Analysis.AmineContent.Database; +using GSS2.Core.Analysis.AmineContent.Database.Results; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; @@ -8,10 +8,10 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; #nullable disable -namespace GSS2.Core.Analysis.AmineContent.Database +namespace GSS2.Core.Analysis.AmineContent.Database.Results { [DbContext(typeof(AmineContentResultsContext))] - [Migration("20251208044924_AmineContentResultsInitial")] + [Migration("20260227055822_AmineContentResultsInitial")] partial class AmineContentResultsInitial { /// @@ -20,7 +20,7 @@ namespace GSS2.Core.Analysis.AmineContent.Database #pragma warning disable 612, 618 modelBuilder.HasAnnotation("ProductVersion", "10.0.0"); - modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+ImageData", b => + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Results.AmineContentResultsContext+ImageData", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -54,7 +54,7 @@ namespace GSS2.Core.Analysis.AmineContent.Database b.ToTable("Images"); }); - modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+Record", b => + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Results.AmineContentResultsContext+Record", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -134,13 +134,13 @@ namespace GSS2.Core.Analysis.AmineContent.Database modelBuilder.Entity("ImageDataRecord", b => { - b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+ImageData", null) + b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Results.AmineContentResultsContext+ImageData", null) .WithMany() .HasForeignKey("SampleImagesId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+Record", null) + b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Results.AmineContentResultsContext+Record", null) .WithMany() .HasForeignKey("SampleRecordsId") .OnDelete(DeleteBehavior.Cascade) @@ -149,13 +149,13 @@ namespace GSS2.Core.Analysis.AmineContent.Database modelBuilder.Entity("ImageDataRecord1", b => { - b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+ImageData", null) + b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Results.AmineContentResultsContext+ImageData", null) .WithMany() .HasForeignKey("SeparatorImagesId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+Record", null) + b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Results.AmineContentResultsContext+Record", null) .WithMany() .HasForeignKey("SeparatorRecordsId") .OnDelete(DeleteBehavior.Cascade) diff --git a/GSS2.Core/Analysis/AmineContent/Database/20251208044924_AmineContentResultsInitial.cs b/GSS2.Core/Analysis/AmineContent/Database/Results/20260227055822_AmineContentResultsInitial.cs similarity index 99% rename from GSS2.Core/Analysis/AmineContent/Database/20251208044924_AmineContentResultsInitial.cs rename to GSS2.Core/Analysis/AmineContent/Database/Results/20260227055822_AmineContentResultsInitial.cs index c68b0be..831a715 100644 --- a/GSS2.Core/Analysis/AmineContent/Database/20251208044924_AmineContentResultsInitial.cs +++ b/GSS2.Core/Analysis/AmineContent/Database/Results/20260227055822_AmineContentResultsInitial.cs @@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace GSS2.Core.Analysis.AmineContent.Database +namespace GSS2.Core.Analysis.AmineContent.Database.Results { /// public partial class AmineContentResultsInitial : Migration diff --git a/GSS2.Core/Analysis/AmineContent/Database/AmineContentResultsContext.cs b/GSS2.Core/Analysis/AmineContent/Database/Results/AmineContentResultsContext.cs similarity index 98% rename from GSS2.Core/Analysis/AmineContent/Database/AmineContentResultsContext.cs rename to GSS2.Core/Analysis/AmineContent/Database/Results/AmineContentResultsContext.cs index 5afde37..d131b50 100644 --- a/GSS2.Core/Analysis/AmineContent/Database/AmineContentResultsContext.cs +++ b/GSS2.Core/Analysis/AmineContent/Database/Results/AmineContentResultsContext.cs @@ -1,6 +1,6 @@ using Microsoft.EntityFrameworkCore; -namespace GSS2.Core.Analysis.AmineContent.Database; +namespace GSS2.Core.Analysis.AmineContent.Database.Results; public class AmineContentResultsContext : DbContext { diff --git a/GSS2.Core/Analysis/AmineContent/Database/AmineContentResultsContextFactory.cs b/GSS2.Core/Analysis/AmineContent/Database/Results/AmineContentResultsContextFactory.cs similarity index 92% rename from GSS2.Core/Analysis/AmineContent/Database/AmineContentResultsContextFactory.cs rename to GSS2.Core/Analysis/AmineContent/Database/Results/AmineContentResultsContextFactory.cs index 7f7c89e..02439ac 100644 --- a/GSS2.Core/Analysis/AmineContent/Database/AmineContentResultsContextFactory.cs +++ b/GSS2.Core/Analysis/AmineContent/Database/Results/AmineContentResultsContextFactory.cs @@ -1,7 +1,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; -namespace GSS2.Core.Analysis.AmineContent.Database; +namespace GSS2.Core.Analysis.AmineContent.Database.Results; public class AmineContentResultsContextFactory : IDesignTimeDbContextFactory { diff --git a/GSS2.Core/Analysis/AmineContent/Database/AmineContentResultsContextModelSnapshot.cs b/GSS2.Core/Analysis/AmineContent/Database/Results/AmineContentResultsContextModelSnapshot.cs similarity index 93% rename from GSS2.Core/Analysis/AmineContent/Database/AmineContentResultsContextModelSnapshot.cs rename to GSS2.Core/Analysis/AmineContent/Database/Results/AmineContentResultsContextModelSnapshot.cs index 5e703f9..9eeb417 100644 --- a/GSS2.Core/Analysis/AmineContent/Database/AmineContentResultsContextModelSnapshot.cs +++ b/GSS2.Core/Analysis/AmineContent/Database/Results/AmineContentResultsContextModelSnapshot.cs @@ -1,13 +1,13 @@ // using System; -using GSS2.Core.Analysis.AmineContent.Database; +using GSS2.Core.Analysis.AmineContent.Database.Results; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; #nullable disable -namespace GSS2.Core.Analysis.AmineContent.Database +namespace GSS2.Core.Analysis.AmineContent.Database.Results { [DbContext(typeof(AmineContentResultsContext))] partial class AmineContentResultsContextModelSnapshot : ModelSnapshot @@ -17,7 +17,7 @@ namespace GSS2.Core.Analysis.AmineContent.Database #pragma warning disable 612, 618 modelBuilder.HasAnnotation("ProductVersion", "10.0.0"); - modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+ImageData", b => + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Results.AmineContentResultsContext+ImageData", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -51,7 +51,7 @@ namespace GSS2.Core.Analysis.AmineContent.Database b.ToTable("Images"); }); - modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+Record", b => + modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Results.AmineContentResultsContext+Record", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -131,13 +131,13 @@ namespace GSS2.Core.Analysis.AmineContent.Database modelBuilder.Entity("ImageDataRecord", b => { - b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+ImageData", null) + b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Results.AmineContentResultsContext+ImageData", null) .WithMany() .HasForeignKey("SampleImagesId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+Record", null) + b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Results.AmineContentResultsContext+Record", null) .WithMany() .HasForeignKey("SampleRecordsId") .OnDelete(DeleteBehavior.Cascade) @@ -146,13 +146,13 @@ namespace GSS2.Core.Analysis.AmineContent.Database modelBuilder.Entity("ImageDataRecord1", b => { - b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+ImageData", null) + b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Results.AmineContentResultsContext+ImageData", null) .WithMany() .HasForeignKey("SeparatorImagesId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+Record", null) + b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Results.AmineContentResultsContext+Record", null) .WithMany() .HasForeignKey("SeparatorRecordsId") .OnDelete(DeleteBehavior.Cascade) diff --git a/GSS2.Core/DependencyInjectionHelper.cs b/GSS2.Core/DependencyInjectionHelper.cs index ef04319..b2c39e3 100644 --- a/GSS2.Core/DependencyInjectionHelper.cs +++ b/GSS2.Core/DependencyInjectionHelper.cs @@ -5,7 +5,8 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using GSS2.Core.Hardware; -using GSS2.Core.Analysis.AmineContent.Database; +using GSS2.Core.Analysis.AmineContent.Database.Calibration; +using GSS2.Core.Analysis.AmineContent.Database.Results; namespace GSS2.Core; diff --git a/GSS2.Core/tools/CreateMigrations.ps1 b/GSS2.Core/tools/CreateMigrations.ps1 index 408ee8c..e301eb9 100644 --- a/GSS2.Core/tools/CreateMigrations.ps1 +++ b/GSS2.Core/tools/CreateMigrations.ps1 @@ -1,2 +1,2 @@ -dotnet ef migrations add -o .\Analysis\AmineContent\Database --project .\GSS2.Core\ AmineContentCalibrationInitial --context AmineContentCalibrationContext -dotnet ef migrations add -o .\Analysis\AmineContent\Database --project .\GSS2.Core\ AmineContentResultsInitial --context AmineContentResultsContext \ No newline at end of file +dotnet ef migrations add -o .\Analysis\AmineContent\Database\Calibration --project .\GSS2.Core\ AmineContentCalibrationInitial --context AmineContentCalibrationContext +dotnet ef migrations add -o .\Analysis\AmineContent\Database\Results --project .\GSS2.Core\ AmineContentResultsInitial --context AmineContentResultsContext \ No newline at end of file diff --git a/GSS2.Core/tools/CreateMigrations.sh b/GSS2.Core/tools/CreateMigrations.sh new file mode 100644 index 0000000..7b73f60 --- /dev/null +++ b/GSS2.Core/tools/CreateMigrations.sh @@ -0,0 +1,2 @@ +dotnet ef migrations add -o ./Analysis/AmineContent/Database/Calibration --project ./GSS2.Core/ AmineContentCalibrationInitial --context AmineContentCalibrationContext +dotnet ef migrations add -o ./Analysis/AmineContent/Database/Results --project ./GSS2.Core/ AmineContentResultsInitial --context AmineContentResultsContext \ No newline at end of file diff --git a/GSS2.Test/PropgramUi.cs b/GSS2.Test/PropgramUi.cs index 53d9e9a..4f69eea 100644 --- a/GSS2.Test/PropgramUi.cs +++ b/GSS2.Test/PropgramUi.cs @@ -8,7 +8,8 @@ using Avalonia.OpenGL.Egl; using GSS2.Core; using GSS2.Core.Logging; -using GSS2.Core.Analysis.AmineContent.Database; +using GSS2.Core.Analysis.AmineContent.Database.Calibration; +using GSS2.Core.Analysis.AmineContent.Database.Results; using ConsoleFormatter = GSS2.Core.Logging.ConsoleFormatter;