70 lines
2.0 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>
/// 用户实体 —— 演示数据库 CRUD 操作。
/// </summary>
[Comment("用户实体,演示数据库 CRUD 操作")]
[Table("user")]
public class UserEntity
{
/// <summary>
/// 获取或设置用户主键 ID自增
/// </summary>
[Key]
[Comment("用户主键")]
[Column("id")]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
/// <summary>
/// 获取或设置用户名称。
/// </summary>
[Comment("用户名称")]
[Column("name")]
[MaxLength(100)]
public string? Name { get; set; }
/// <summary>
/// 获取或设置用户密码哈希值。
/// </summary>
[Comment("密码哈希值")]
[Column("password-hash")]
[MaxLength(200)]
public string? PasswordHash { get; set; }
/// <summary>
/// 获取或设置用户邮箱。
/// </summary>
[Comment("用户邮箱")]
[Column("email")]
[MaxLength(200)]
public string? Email { get; set; }
/// <summary>
/// 获取或设置用户电话号码。
/// </summary>
[Comment("电话号码")]
[Column("phone-number")]
[MaxLength(50)]
public string? PhoneNumber { 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;
}
}