File size: 991 Bytes
5fc700d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
using FreeSql.DataAnnotations;
namespace ToolHub.Models;
[Table(Name = "Users")]
public class User
{
[Column(IsIdentity = true, IsPrimary = true)]
public int Id { get; set; }
[Column(StringLength = 50)]
public string UserName { get; set; } = string.Empty;
[Column(StringLength = 100)]
public string Email { get; set; } = string.Empty;
[Column(StringLength = 255)]
public string PasswordHash { get; set; } = string.Empty;
[Column(StringLength = 20)]
public string? NickName { get; set; }
[Column(StringLength = 255)]
public string? Avatar { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.Now;
public DateTime? UpdatedAt { get; set; }
public bool IsActive { get; set; } = true;
[Column(StringLength = 10)]
public string Role { get; set; } = "User"; // User, Admin
// 导航属性
[Navigate(nameof(UserFavorite.UserId))]
public List<UserFavorite> UserFavorites { get; set; } = new();
}
|