78 lines
1.9 KiB
C#
78 lines
1.9 KiB
C#
using Cowain.Base.DBContext;
|
|
using Cowain.Base.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace Plugin.Cowain.Driver.Models.Dto;
|
|
|
|
|
|
[Table("device")]
|
|
public class DeviceDto : BaseModel
|
|
{
|
|
[Key]
|
|
public int Id { get; set; }
|
|
/// <summary>
|
|
/// 设备名称
|
|
/// </summary>
|
|
[Required]
|
|
[MaxLength(50)]
|
|
public string DeviceName { get; set; } = string.Empty;
|
|
/// <summary>
|
|
/// 驱动名称
|
|
/// </summary>
|
|
[Required]
|
|
[MaxLength(50)]
|
|
public string DriverName { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 设备类型
|
|
/// </summary>
|
|
[Required]
|
|
[MaxLength(20)]
|
|
public string DeviceType { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 连接参数
|
|
/// </summary>
|
|
[Required]
|
|
public string Param { get; set; } = string.Empty;
|
|
/// <summary>
|
|
/// 备注
|
|
/// </summary>
|
|
public string? Desc { get; set; }
|
|
|
|
public bool Enable { get; set; }
|
|
/// <summary>
|
|
/// 创建时间
|
|
/// </summary>
|
|
public DateTime CreateTime { get; set; } = DateTime.Now;
|
|
|
|
/// <summary>
|
|
/// 最后一次更新时间
|
|
/// </summary>
|
|
public DateTime UpdateTime { get; set; } = DateTime.MinValue;
|
|
}
|
|
|
|
|
|
//public class DeviceSeed : IDataSeeding
|
|
//{
|
|
// public void DataSeeding(ModelBuilder modelBuilder)
|
|
// {
|
|
// modelBuilder.Entity<DeviceDto>().HasData(
|
|
// new DeviceDto
|
|
// {
|
|
// Id = 1,
|
|
// DeviceName = "plc1",
|
|
// DeviceType = "PLC",
|
|
// DriverName = "SiemensS7Tcp",
|
|
// Param = "{\r\n \"IpAddress\": \"127.0.0.1\",\r\n \"Port\": 102,\r\n \"Slot\": 0,\r\n \"Rack\": 0,\r\n \"DataFormat\": \"ABCD\",\r\n \"SiemensPLCS\": \"S1500\"\r\n}",
|
|
// Enable = true,
|
|
// Desc = "测试PLC"
|
|
// }
|
|
// );
|
|
|
|
// }
|
|
//}
|
|
|