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

36 lines
1.1 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;
#nullable disable
namespace AsbCloudDb.Model
{
[Table("t_event"), Comment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии.")]
public partial class Event
{
[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))]
public virtual Telemetry Telemetry { get; set; }
[Column("id_category")]
2021-04-23 10:21:25 +05:00
public int IdCategory { get; set; }
[Column("message_template")]
public string MessageTemplate { get; set; }
2021-04-23 10:21:25 +05:00
public string MakeMessageText(Message message)
{
var args = new string[] { message.Arg0, message.Arg1, message.Arg2, message.Arg3 };
return string.Format(MessageTemplate, args);
}
}
}