forked from amkovkov/GranuSightSoftware2
feat: migrations update
Added tool for migrations Updated AmineContentCalibration db Create AmineContentResults db
This commit is contained in:
@@ -1,6 +1,21 @@
|
|||||||
|
using GSS2.Core.Analysis.AmineContent.Database;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace GSS2.Core.Analysis.AmineContent;
|
namespace GSS2.Core.Analysis.AmineContent;
|
||||||
|
|
||||||
public class AmineContentCalibrationDataService
|
public class AmineContentCalibrationDataService
|
||||||
{
|
{
|
||||||
|
private readonly ILogger<AmineContentCalibrationDataService> _logger;
|
||||||
|
private AmineContentCalibrationContext _calibrationContext;
|
||||||
|
|
||||||
|
public AmineContentCalibrationDataService(ILogger<AmineContentCalibrationDataService> logger, AmineContentCalibrationContext calibrationContext)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_calibrationContext = calibrationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task LoadData(CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using GSS2.Core.Analysis.AmineContent.Database;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace GSS2.Core.Analysis.AmineContent;
|
||||||
|
|
||||||
|
public class AmineContentResultsDataService
|
||||||
|
{
|
||||||
|
private readonly ILogger<AmineContentResultsDataService> _logger;
|
||||||
|
private AmineContentCalibrationContext _calibrationContext;
|
||||||
|
|
||||||
|
public AmineContentResultsDataService(ILogger<AmineContentResultsDataService> logger, AmineContentCalibrationContext calibrationContext)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_calibrationContext = calibrationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task LoadData(CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-2
@@ -11,8 +11,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace GSS2.Core.Analysis.AmineContent.Database
|
namespace GSS2.Core.Analysis.AmineContent.Database
|
||||||
{
|
{
|
||||||
[DbContext(typeof(AmineContentCalibrationContext))]
|
[DbContext(typeof(AmineContentCalibrationContext))]
|
||||||
[Migration("20251125054200_Initial")]
|
[Migration("20251208044919_AmineContentCalibrationInitial")]
|
||||||
partial class Initial
|
partial class AmineContentCalibrationInitial
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
+1
-1
@@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
namespace GSS2.Core.Analysis.AmineContent.Database
|
namespace GSS2.Core.Analysis.AmineContent.Database
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class Initial : Migration
|
public partial class AmineContentCalibrationInitial : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
Generated
+167
@@ -0,0 +1,167 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using GSS2.Core.Analysis.AmineContent.Database;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace GSS2.Core.Analysis.AmineContent.Database
|
||||||
|
{
|
||||||
|
[DbContext(typeof(AmineContentResultsContext))]
|
||||||
|
[Migration("20251208044924_AmineContentResultsInitial")]
|
||||||
|
partial class AmineContentResultsInitial
|
||||||
|
{
|
||||||
|
/// <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.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.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.AmineContentResultsContext+ImageData", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SampleImagesId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+Record", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SampleRecordsId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ImageDataRecord1", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+ImageData", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SeparatorImagesId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+Record", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SeparatorRecordsId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+126
@@ -0,0 +1,126 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace GSS2.Core.Analysis.AmineContent.Database
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AmineContentResultsInitial : 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,8 @@ public class AmineContentCalibrationContextFactory : IDesignTimeDbContextFactory
|
|||||||
{
|
{
|
||||||
var optionsBuilder = new DbContextOptionsBuilder<AmineContentCalibrationContext>();
|
var optionsBuilder = new DbContextOptionsBuilder<AmineContentCalibrationContext>();
|
||||||
|
|
||||||
// строка подключения для миграций (в design-time)
|
// Строка подключения для миграций в design-time
|
||||||
|
// в runtime должна использоваться настоящая ConnectionString
|
||||||
optionsBuilder.UseSqlite("Data Source=AmineContentCalibration.db");
|
optionsBuilder.UseSqlite("Data Source=AmineContentCalibration.db");
|
||||||
|
|
||||||
return new AmineContentCalibrationContext(optionsBuilder.Options);
|
return new AmineContentCalibrationContext(optionsBuilder.Options);
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace GSS2.Core.Analysis.AmineContent.Database;
|
||||||
|
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Design;
|
||||||
|
|
||||||
|
namespace GSS2.Core.Analysis.AmineContent.Database;
|
||||||
|
|
||||||
|
public class AmineContentResultsContextFactory : IDesignTimeDbContextFactory<AmineContentResultsContext>
|
||||||
|
{
|
||||||
|
public AmineContentResultsContext CreateDbContext(string[] args)
|
||||||
|
{
|
||||||
|
var optionsBuilder = new DbContextOptionsBuilder<AmineContentResultsContext>();
|
||||||
|
|
||||||
|
// Строка подключения для миграций в design-time
|
||||||
|
// в runtime должна использоваться настоящая ConnectionString
|
||||||
|
optionsBuilder.UseSqlite("Data Source=AmineContentResults.db");
|
||||||
|
|
||||||
|
return new AmineContentResultsContext(optionsBuilder.Options);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,164 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using GSS2.Core.Analysis.AmineContent.Database;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace GSS2.Core.Analysis.AmineContent.Database
|
||||||
|
{
|
||||||
|
[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.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.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.AmineContentResultsContext+ImageData", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SampleImagesId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+Record", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SampleRecordsId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ImageDataRecord1", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+ImageData", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SeparatorImagesId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("GSS2.Core.Analysis.AmineContent.Database.AmineContentResultsContext+Record", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SeparatorRecordsId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +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
|
||||||
Reference in New Issue
Block a user