forked from ddrilling/AsbCloudServer
34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace AsbCloudDb.Model
|
|
{
|
|
[Table("t_telemetry_event"), Comment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии.")]
|
|
public partial class TelemetryEvent
|
|
{
|
|
[Column("id_event")]
|
|
public int IdEvent { get; set; }
|
|
|
|
[Column("id_telemetry")]
|
|
public int IdTelemetry { get; set; }
|
|
|
|
[JsonIgnore]
|
|
[ForeignKey(nameof(IdTelemetry))]
|
|
[InverseProperty(nameof(Model.Telemetry.Events))]
|
|
public virtual Telemetry Telemetry { get; set; } = null!;
|
|
|
|
[Column("id_category")]
|
|
public int IdCategory { get; set; }
|
|
|
|
[Column("message_template")]
|
|
public string MessageTemplate { get; set; } = string.Empty;
|
|
|
|
public string MakeMessageText(TelemetryMessage message)
|
|
{
|
|
var args = new string?[] { message.Arg0, message.Arg1, message.Arg2, message.Arg3 };
|
|
return string.Format(MessageTemplate, args);
|
|
}
|
|
}
|
|
}
|