FileShare/FileShare-EFCore/Models/WeatherForecastEntity.cs

60 lines
1.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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