using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HBLConsole.Model { [Table(nameof(AlarmSet))] public class AlarmSet { public AlarmSet() { AnalogAlarmModels.Clear(); foreach (var item in Enum.GetNames(typeof(EAnalogAlarmType))) { AnalogAlarmModels.Add(new AnalogAlarmModel() { AlarmTag = item, SortTag = (EAnalogAlarmType)Enum.Parse(typeof(EAnalogAlarmType), item) }); } } [Key] public int Id { get; set; } /// /// 模拟量报警信息 /// public ObservableCollection AnalogAlarmModels { get; set; } = new ObservableCollection(); /// /// 离散量报警信息 /// public DiscreteAlarmInfo DiscreteAlarmInfoSet { get; set; } = new DiscreteAlarmInfo(); /// /// 设置外键 /// [ForeignKey("VariableInfoId")] public int VariableInfoId { get; set; } /// /// 设置导航属性 /// public VariableInfo VariableInfo { get; set; } } }