forked from amkovkov/GranuSightSoftware2
Первый коммит
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
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<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 AmineContentCalibrationContext(DbContextOptions<AmineContentCalibrationContext> 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"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user