Toolhub / Models /User.cs
unifare
Initial commit: ToolHub ASP.NET Core app
5fc700d
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();
}