Toolhub / Models /Tool.cs
unifare
Initial commit: ToolHub ASP.NET Core app
5fc700d
using FreeSql.DataAnnotations;
namespace ToolHub.Models;
[Table(Name = "Tools")]
public class Tool
{
[Column(IsIdentity = true, IsPrimary = true)]
public int Id { get; set; }
[Column(StringLength = 200)]
public string Name { get; set; } = string.Empty;
[Column(StringLength = 1000)]
public string? Description { get; set; }
[Column(StringLength = 500)]
public string? Icon { get; set; }
[Column(StringLength = 500)]
public string? Image { get; set; }
[Column(StringLength = 500)]
public string? Url { get; set; }
public int CategoryId { get; set; }
public int ViewCount { get; set; } = 0;
public int FavoriteCount { get; set; } = 0;
public decimal Rating { get; set; } = 0;
public int RatingCount { get; set; } = 0;
public bool IsHot { get; set; } = false;
public bool IsNew { get; set; } = false;
public bool IsRecommended { get; set; } = false;
public bool IsActive { get; set; } = true;
public int SortOrder { get; set; } = 0;
public DateTime CreatedAt { get; set; } = DateTime.Now;
public DateTime? UpdatedAt { get; set; }
// 导航属性
[Navigate(nameof(CategoryId))]
public Category Category { get; set; } = null!;
[Navigate(nameof(UserFavorite.ToolId))]
public List<UserFavorite> UserFavorites { get; set; } = new();
[Navigate(nameof(ToolTag.ToolId))]
public List<ToolTag> ToolTags { get; set; } = new();
}