DD.WellWorkover.Cloud/AsbCloudDb/Model/GTR/WitsItemBase.cs

38 lines
1.2 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.GTR
{
public class WitsItemBase<T> : ITelemetryData
where T: notnull
{
[Column("id_telemetry")]
public int IdTelemetry { get; set; }
[Column("id_record")]
public int IdRecord { get; set; }
[Column("id_item")]
public int IdItem { get; set; }
[Column("date", TypeName = "timestamp with time zone")]
public DateTimeOffset DateTime { get; set; }
[Column("value")]
public T Value { get; set; } = default!;
[ForeignKey(nameof(IdTelemetry))]
public virtual Telemetry? Telemetry { get; set; }
}
[Table("t_wits_string"), Comment("таблица данных ГТИ с типом значения string")]
public class WitsItemString : WitsItemBase<string> { }
[Table("t_wits_float"), Comment("таблица данных ГТИ с типом значения float")]
public class WitsItemFloat : WitsItemBase<float> { }
[Table("t_wits_int"), Comment("таблица данных ГТИ с типом значения int")]
public class WitsItemInt : WitsItemBase<int> { }
}