DD.WellWorkover.Cloud/AsbCloudDb/Model/TelemetryEvent.cs

34 lines
1.2 KiB
C#
Raw Normal View History

using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
2021-04-23 10:21:25 +05:00
using System.Text.Json.Serialization;
namespace AsbCloudDb.Model
{
2021-08-10 15:53:11 +05:00
[Table("t_telemetry_event"), Comment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии.")]
public partial class TelemetryEvent
{
[Column("id_event")]
2021-04-23 10:21:25 +05:00
public int IdEvent { get; set; }
[Column("id_telemetry")]
public int IdTelemetry { get; set; }
[JsonIgnore]
[ForeignKey(nameof(IdTelemetry))]
[InverseProperty(nameof(Model.Telemetry.Events))]
2023-02-20 15:06:26 +05:00
public virtual Telemetry Telemetry { get; set; } = null!;
2021-04-23 10:21:25 +05:00
[Column("id_category")]
2021-04-23 10:21:25 +05:00
public int IdCategory { get; set; }
[Column("message_template")]
2023-02-20 15:06:26 +05:00
public string MessageTemplate { get; set; } = string.Empty;
2021-04-23 10:21:25 +05:00
2021-08-10 15:53:11 +05:00
public string MakeMessageText(TelemetryMessage message)
2021-04-23 10:21:25 +05:00
{
2023-02-20 15:06:26 +05:00
var args = new string?[] { message.Arg0, message.Arg1, message.Arg2, message.Arg3 };
2021-04-23 10:21:25 +05:00
return string.Format(MessageTemplate, args);
}
}
}