feat: massive rework

1) GSS2.Core:
- strip prefixes in GSS2.Core.Analysis.AmineContent namespace class names
- add IEnumerable<double>.Variance extension
- remake analysis + update database so not needed to store all every file, calibration data also stored in database, also currently capturing images stored in system temporary directory and rewriting every time
2) GSS.UI.Core: AsyncImageRecordViewModel make zoom and pans public
3) GSS:
- remove image-storage-clear command
- remove ResultsView and ResultsViewModel, results presented in analysis
- rework calibration views
- add analysis views
- add text and number fields editors view
- add confirmation view on danger buttons
This commit is contained in:
2026-05-13 12:56:32 +03:00
parent ec95eef375
commit 3cc4d21947
63 changed files with 4359 additions and 3961 deletions
@@ -1,70 +0,0 @@
using Microsoft.EntityFrameworkCore;
namespace GSS2.Core.Analysis.AmineContent.Database.Results;
public class AmineContentResultsContext : 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 List<ImageData> SampleImages { get; set; } = new();
[Comment("Изображения пустого сепаратора")]
public List<ImageData> 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<Record> SampleRecords { get; set; } = new();
[Comment("Записи в которых это изображение используется как изображение сепаратора")]
public List<Record> SeparatorRecords { get; set; } = new();
}
public DbSet<Record> Records => Set<Record>();
public DbSet<ImageData> Images => Set<ImageData>();
public AmineContentResultsContext(DbContextOptions<AmineContentResultsContext> options) : base(options) { }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Record>()
.HasMany(r => r.SampleImages)
.WithMany(i => i.SampleRecords)
.UsingEntity(j => j.ToTable("SampleImages"));
modelBuilder.Entity<Record>()
.HasMany(r => r.SeparatorImages)
.WithMany(i => i.SeparatorRecords)
.UsingEntity(j => j.ToTable("SeparatorImages"));
}
}
@@ -1,167 +0,0 @@
// <auto-generated />
using System;
using GSS2.Core.Analysis.AmineContent.Database.Results;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GSS2.Core.Analysis.AmineContent.Database.Results.Migrations
{
[DbContext(typeof(AmineContentResultsContext))]
[Migration("20260313083009_AmineContentResults0")]
partial class AmineContentResults0
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.0");
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Results.AmineContentResultsContext+ImageData", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Уникальный идентификатор");
b.Property<string>("ImagePath")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Путь к файлу изображения");
b.Property<string>("ImageType")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Тип изображения (sample - проба или separator - сепаратор)");
b.Property<double>("Uv254Intensity")
.HasColumnType("REAL")
.HasComment("Интенсивность УФ излучения 254 нм (0..1)");
b.Property<double>("Uv365Intensity")
.HasColumnType("REAL")
.HasComment("Интенсивность УФ излучения 365 нм (0..1)");
b.Property<double>("VisibleIntensity")
.HasColumnType("REAL")
.HasComment("Интенсивность видимого света (0..1)");
b.HasKey("Id");
b.ToTable("Images");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Results.AmineContentResultsContext+Record", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Уникальный идентификатор");
b.Property<double>("AirHumidity")
.HasColumnType("REAL")
.HasComment("Относительная влажность воздуха (%)");
b.Property<double>("AirTemperature")
.HasColumnType("REAL")
.HasComment("Температура воздуха (℃)");
b.Property<string>("SampleBrand")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Марка пробы");
b.Property<string>("SampleComment")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Дополнительная информация о пробе");
b.Property<double>("SampleMass")
.HasColumnType("REAL")
.HasComment("Масса пробы (кг)");
b.Property<string>("SampleName")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Название пробы");
b.Property<DateTime>("SamplingDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время отбора пробы");
b.Property<string>("SamplingPlace")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Место отбора пробы");
b.HasKey("Id");
b.ToTable("Records");
});
modelBuilder.Entity("ImageDataRecord", b =>
{
b.Property<int>("SampleImagesId")
.HasColumnType("INTEGER");
b.Property<int>("SampleRecordsId")
.HasColumnType("INTEGER");
b.HasKey("SampleImagesId", "SampleRecordsId");
b.HasIndex("SampleRecordsId");
b.ToTable("SampleImages", (string)null);
});
modelBuilder.Entity("ImageDataRecord1", b =>
{
b.Property<int>("SeparatorImagesId")
.HasColumnType("INTEGER");
b.Property<int>("SeparatorRecordsId")
.HasColumnType("INTEGER");
b.HasKey("SeparatorImagesId", "SeparatorRecordsId");
b.HasIndex("SeparatorRecordsId");
b.ToTable("SeparatorImages", (string)null);
});
modelBuilder.Entity("ImageDataRecord", b =>
{
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.Results.AmineContentResultsContext+Record", null)
.WithMany()
.HasForeignKey("SampleRecordsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ImageDataRecord1", b =>
{
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.Results.AmineContentResultsContext+Record", null)
.WithMany()
.HasForeignKey("SeparatorRecordsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
@@ -1,126 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GSS2.Core.Analysis.AmineContent.Database.Results.Migrations
{
/// <inheritdoc />
public partial class AmineContentResults0 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Images",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false, comment: "Уникальный идентификатор")
.Annotation("Sqlite:Autoincrement", true),
VisibleIntensity = table.Column<double>(type: "REAL", nullable: false, comment: "Интенсивность видимого света (0..1)"),
Uv365Intensity = table.Column<double>(type: "REAL", nullable: false, comment: "Интенсивность УФ излучения 365 нм (0..1)"),
Uv254Intensity = table.Column<double>(type: "REAL", nullable: false, comment: "Интенсивность УФ излучения 254 нм (0..1)"),
ImageType = table.Column<string>(type: "TEXT", nullable: false, comment: "Тип изображения (sample - проба или separator - сепаратор)"),
ImagePath = table.Column<string>(type: "TEXT", nullable: false, comment: "Путь к файлу изображения")
},
constraints: table =>
{
table.PrimaryKey("PK_Images", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Records",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false, comment: "Уникальный идентификатор")
.Annotation("Sqlite:Autoincrement", true),
SampleName = table.Column<string>(type: "TEXT", nullable: false, comment: "Название пробы"),
SampleComment = table.Column<string>(type: "TEXT", nullable: false, comment: "Дополнительная информация о пробе"),
SampleBrand = table.Column<string>(type: "TEXT", nullable: false, comment: "Марка пробы"),
SampleMass = table.Column<double>(type: "REAL", nullable: false, comment: "Масса пробы (кг)"),
SamplingDateTime = table.Column<DateTime>(type: "TEXT", nullable: false, comment: "Дата и время отбора пробы"),
SamplingPlace = table.Column<string>(type: "TEXT", nullable: false, comment: "Место отбора пробы"),
AirTemperature = table.Column<double>(type: "REAL", nullable: false, comment: "Температура воздуха (℃)"),
AirHumidity = table.Column<double>(type: "REAL", nullable: false, comment: "Относительная влажность воздуха (%)")
},
constraints: table =>
{
table.PrimaryKey("PK_Records", x => x.Id);
});
migrationBuilder.CreateTable(
name: "SampleImages",
columns: table => new
{
SampleImagesId = table.Column<int>(type: "INTEGER", nullable: false),
SampleRecordsId = table.Column<int>(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<int>(type: "INTEGER", nullable: false),
SeparatorRecordsId = table.Column<int>(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");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SampleImages");
migrationBuilder.DropTable(
name: "SeparatorImages");
migrationBuilder.DropTable(
name: "Images");
migrationBuilder.DropTable(
name: "Records");
}
}
}
@@ -0,0 +1,123 @@
// <auto-generated />
using System;
using GSS2.Core.Analysis.AmineContent.Database.Results;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GSS2.Core.Analysis.AmineContent.Database.Results.Migrations
{
[DbContext(typeof(ResultsContext))]
[Migration("20260429070705_Results0")]
partial class Results0
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.0");
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Results.ResultRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Уникальный идентификатор");
b.Property<string>("Image")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Изображение");
b.Property<string>("MaskImage")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Маска");
b.Property<double>("MaxValue")
.HasColumnType("REAL")
.HasComment("Максимальное значение");
b.Property<double>("MeanValue")
.HasColumnType("REAL")
.HasComment("Среднее значение");
b.PrimitiveCollection<string>("MeanValues")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Средние значения");
b.Property<double>("MeanVariance")
.HasColumnType("REAL")
.HasComment("Средняя дисперсия");
b.Property<double>("MinValue")
.HasColumnType("REAL")
.HasComment("Минимальное значение");
b.Property<int>("ParticlesCount")
.HasColumnType("INTEGER")
.HasComment("Количество частиц");
b.Property<string>("ResultImage")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Изображение результата");
b.Property<string>("SampleBrand")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Марка пробы");
b.Property<string>("SampleComment")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("TEXT")
.HasComment("Дополнительная информация о пробе");
b.Property<string>("SampleName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Название пробы");
b.Property<DateTime>("SamplingDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время отбора пробы");
b.Property<string>("SamplingPlace")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Место отбора пробы");
b.Property<string>("SeparatorType")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Тип сепаратора");
b.Property<double>("VarianceOfMean")
.HasColumnType("REAL")
.HasComment("Дисперсия среднего");
b.PrimitiveCollection<string>("Variances")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Дисперсии");
b.HasKey("Id");
b.ToTable("ResultRecords");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,51 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GSS2.Core.Analysis.AmineContent.Database.Results.Migrations
{
/// <inheritdoc />
public partial class Results0 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ResultRecords",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false, comment: "Уникальный идентификатор")
.Annotation("Sqlite:Autoincrement", true),
SampleName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Название пробы"),
SampleComment = table.Column<string>(type: "TEXT", maxLength: 512, nullable: false, comment: "Дополнительная информация о пробе"),
SamplingDateTime = table.Column<DateTime>(type: "TEXT", nullable: false, comment: "Дата и время отбора пробы"),
SamplingPlace = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Место отбора пробы"),
Image = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Изображение"),
SeparatorType = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Тип сепаратора"),
SampleBrand = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Марка пробы"),
MaskImage = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Маска"),
ResultImage = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Изображение результата"),
MinValue = table.Column<double>(type: "REAL", nullable: false, comment: "Минимальное значение"),
MaxValue = table.Column<double>(type: "REAL", nullable: false, comment: "Максимальное значение"),
ParticlesCount = table.Column<int>(type: "INTEGER", nullable: false, comment: "Количество частиц"),
MeanValue = table.Column<double>(type: "REAL", nullable: false, comment: "Среднее значение"),
MeanVariance = table.Column<double>(type: "REAL", nullable: false, comment: "Средняя дисперсия"),
VarianceOfMean = table.Column<double>(type: "REAL", nullable: false, comment: "Дисперсия среднего"),
MeanValues = table.Column<string>(type: "TEXT", nullable: false, comment: "Средние значения"),
Variances = table.Column<string>(type: "TEXT", nullable: false, comment: "Дисперсии")
},
constraints: table =>
{
table.PrimaryKey("PK_ResultRecords", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ResultRecords");
}
}
}
@@ -1,164 +0,0 @@
// <auto-generated />
using System;
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.Results.Migrations
{
[DbContext(typeof(AmineContentResultsContext))]
partial class AmineContentResultsContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.0");
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Results.AmineContentResultsContext+ImageData", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Уникальный идентификатор");
b.Property<string>("ImagePath")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Путь к файлу изображения");
b.Property<string>("ImageType")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Тип изображения (sample - проба или separator - сепаратор)");
b.Property<double>("Uv254Intensity")
.HasColumnType("REAL")
.HasComment("Интенсивность УФ излучения 254 нм (0..1)");
b.Property<double>("Uv365Intensity")
.HasColumnType("REAL")
.HasComment("Интенсивность УФ излучения 365 нм (0..1)");
b.Property<double>("VisibleIntensity")
.HasColumnType("REAL")
.HasComment("Интенсивность видимого света (0..1)");
b.HasKey("Id");
b.ToTable("Images");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Results.AmineContentResultsContext+Record", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Уникальный идентификатор");
b.Property<double>("AirHumidity")
.HasColumnType("REAL")
.HasComment("Относительная влажность воздуха (%)");
b.Property<double>("AirTemperature")
.HasColumnType("REAL")
.HasComment("Температура воздуха (℃)");
b.Property<string>("SampleBrand")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Марка пробы");
b.Property<string>("SampleComment")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Дополнительная информация о пробе");
b.Property<double>("SampleMass")
.HasColumnType("REAL")
.HasComment("Масса пробы (кг)");
b.Property<string>("SampleName")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Название пробы");
b.Property<DateTime>("SamplingDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время отбора пробы");
b.Property<string>("SamplingPlace")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Место отбора пробы");
b.HasKey("Id");
b.ToTable("Records");
});
modelBuilder.Entity("ImageDataRecord", b =>
{
b.Property<int>("SampleImagesId")
.HasColumnType("INTEGER");
b.Property<int>("SampleRecordsId")
.HasColumnType("INTEGER");
b.HasKey("SampleImagesId", "SampleRecordsId");
b.HasIndex("SampleRecordsId");
b.ToTable("SampleImages", (string)null);
});
modelBuilder.Entity("ImageDataRecord1", b =>
{
b.Property<int>("SeparatorImagesId")
.HasColumnType("INTEGER");
b.Property<int>("SeparatorRecordsId")
.HasColumnType("INTEGER");
b.HasKey("SeparatorImagesId", "SeparatorRecordsId");
b.HasIndex("SeparatorRecordsId");
b.ToTable("SeparatorImages", (string)null);
});
modelBuilder.Entity("ImageDataRecord", b =>
{
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.Results.AmineContentResultsContext+Record", null)
.WithMany()
.HasForeignKey("SampleRecordsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ImageDataRecord1", b =>
{
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.Results.AmineContentResultsContext+Record", null)
.WithMany()
.HasForeignKey("SeparatorRecordsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,120 @@
// <auto-generated />
using System;
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.Results.Migrations
{
[DbContext(typeof(ResultsContext))]
partial class ResultsContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.0");
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Results.ResultRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Уникальный идентификатор");
b.Property<string>("Image")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Изображение");
b.Property<string>("MaskImage")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Маска");
b.Property<double>("MaxValue")
.HasColumnType("REAL")
.HasComment("Максимальное значение");
b.Property<double>("MeanValue")
.HasColumnType("REAL")
.HasComment("Среднее значение");
b.PrimitiveCollection<string>("MeanValues")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Средние значения");
b.Property<double>("MeanVariance")
.HasColumnType("REAL")
.HasComment("Средняя дисперсия");
b.Property<double>("MinValue")
.HasColumnType("REAL")
.HasComment("Минимальное значение");
b.Property<int>("ParticlesCount")
.HasColumnType("INTEGER")
.HasComment("Количество частиц");
b.Property<string>("ResultImage")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Изображение результата");
b.Property<string>("SampleBrand")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Марка пробы");
b.Property<string>("SampleComment")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("TEXT")
.HasComment("Дополнительная информация о пробе");
b.Property<string>("SampleName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Название пробы");
b.Property<DateTime>("SamplingDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время отбора пробы");
b.Property<string>("SamplingPlace")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Место отбора пробы");
b.Property<string>("SeparatorType")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Тип сепаратора");
b.Property<double>("VarianceOfMean")
.HasColumnType("REAL")
.HasComment("Дисперсия среднего");
b.PrimitiveCollection<string>("Variances")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Дисперсии");
b.HasKey("Id");
b.ToTable("ResultRecords");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,53 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace GSS2.Core.Analysis.AmineContent.Database.Results;
public class ResultRecord
{
[Comment("Уникальный идентификатор")]
public int Id { get; set; }
[Comment("Название пробы")]
[MaxLength(256)]
public required string SampleName { get; set; }
[Comment("Дополнительная информация о пробе")]
[MaxLength(512)]
public required string SampleComment { get; set; }
[Comment("Дата и время отбора пробы")]
public required DateTime SamplingDateTime { get; set; }
[Comment("Место отбора пробы")]
[MaxLength(256)]
public required string SamplingPlace { get; set; }
[Comment("Изображение")]
[MaxLength(256)]
public required string Image { get; set; }
[Comment("Тип сепаратора")]
[MaxLength(256)]
public required string SeparatorType { get; set; }
[Comment("Марка пробы")]
[MaxLength(256)]
public required string SampleBrand { get; set; }
[Comment("Маска")]
[MaxLength(256)]
public required string MaskImage { get; set; }
[Comment("Изображение результата")]
[MaxLength(256)]
public required string ResultImage { get; set; }
[Comment("Минимальное значение")]
public required double MinValue { get; set; }
[Comment("Максимальное значение")]
public required double MaxValue { get; set; }
[Comment("Количество частиц")]
public required int ParticlesCount { get; set; }
[Comment("Среднее значение")]
public required double MeanValue { get; set; }
[Comment("Средняя дисперсия")]
public required double MeanVariance { get; set; }
[Comment("Дисперсия среднего")]
public required double VarianceOfMean { get; set; }
[Comment("Средние значения")]
public required double[] MeanValues { get; set; }
[Comment("Дисперсии")]
public required double[] Variances { get; set; }
}
@@ -0,0 +1,12 @@
using Microsoft.EntityFrameworkCore;
namespace GSS2.Core.Analysis.AmineContent.Database.Results;
public class ResultsContext : DbContext
{
public DbSet<ResultRecord> ResultRecords => Set<ResultRecord>();
public ResultsContext(DbContextOptions<ResultsContext> options)
: base(options)
{ }
}
@@ -3,16 +3,16 @@ using Microsoft.EntityFrameworkCore.Design;
namespace GSS2.Core.Analysis.AmineContent.Database.Results;
public class AmineContentResultsContextFactory : IDesignTimeDbContextFactory<AmineContentResultsContext>
public class ResultsContextFactory : IDesignTimeDbContextFactory<ResultsContext>
{
public AmineContentResultsContext CreateDbContext(string[] args)
public ResultsContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder<AmineContentResultsContext>();
var optionsBuilder = new DbContextOptionsBuilder<ResultsContext>();
// Строка подключения для миграций в design-time
// в runtime должна использоваться настоящая ConnectionString
// в runtime должна использоваться настоящая ConnectionString
optionsBuilder.UseSqlite("Data Source=AmineContentResults.db");
return new AmineContentResultsContext(optionsBuilder.Options);
return new ResultsContext(optionsBuilder.Options);
}
}