2026-05-15 15:26:46 +08:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
2026-05-11 14:35:34 +08:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
|
|
2026-05-15 15:26:46 +08:00
|
|
|
|
namespace Avalonia_EFCore.Models
|
2026-05-11 14:35:34 +08:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2026-05-15 15:26:46 +08:00
|
|
|
|
/// 天气预报数据实体。
|
2026-05-11 14:35:34 +08:00
|
|
|
|
/// </summary>
|
2026-05-15 15:26:46 +08:00
|
|
|
|
[Comment("天气预报数据实体")]
|
|
|
|
|
|
[Table("weather-forecast")]
|
2026-05-11 14:35:34 +08:00
|
|
|
|
public class WeatherForecastEntity
|
|
|
|
|
|
{
|
2026-05-18 11:35:13 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取或设置天气预报主键 ID(自增)。
|
|
|
|
|
|
/// </summary>
|
2026-05-11 14:35:34 +08:00
|
|
|
|
[Key]
|
2026-05-15 15:26:46 +08:00
|
|
|
|
[Comment("天气预报主键")]
|
|
|
|
|
|
[Column("id")]
|
2026-05-11 14:35:34 +08:00
|
|
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
|
|
2026-05-18 11:35:13 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取或设置预报日期。
|
|
|
|
|
|
/// </summary>
|
2026-05-15 15:26:46 +08:00
|
|
|
|
[Comment("预报日期")]
|
|
|
|
|
|
[Column("date")]
|
2026-05-11 14:35:34 +08:00
|
|
|
|
public DateOnly Date { get; set; }
|
|
|
|
|
|
|
2026-05-18 11:35:13 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取或设置摄氏温度。
|
|
|
|
|
|
/// </summary>
|
2026-05-15 15:26:46 +08:00
|
|
|
|
[Comment("摄氏温度")]
|
|
|
|
|
|
[Column("temperature-c")]
|
2026-05-11 14:35:34 +08:00
|
|
|
|
public int TemperatureC { get; set; }
|
|
|
|
|
|
|
2026-05-18 11:35:13 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取或设置天气摘要。
|
|
|
|
|
|
/// </summary>
|
2026-05-15 15:26:46 +08:00
|
|
|
|
[Comment("天气摘要")]
|
|
|
|
|
|
[Column("summary")]
|
2026-05-11 14:35:34 +08:00
|
|
|
|
[MaxLength(200)]
|
|
|
|
|
|
public string? Summary { get; set; }
|
|
|
|
|
|
|
2026-05-18 11:35:13 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取或设置记录创建时间。
|
|
|
|
|
|
/// </summary>
|
2026-05-15 15:26:46 +08:00
|
|
|
|
[Comment("创建时间")]
|
|
|
|
|
|
[Column("created-at")]
|
2026-05-11 14:35:34 +08:00
|
|
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
|
|
|
2026-05-18 11:35:13 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取或设置记录最后更新时间。
|
|
|
|
|
|
/// </summary>
|
2026-05-15 15:26:46 +08:00
|
|
|
|
[Comment("更新时间")]
|
|
|
|
|
|
[Column("updated-at")]
|
2026-05-11 14:35:34 +08:00
|
|
|
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|