Entity.cs 648 B

12345678910111213141516171819202122232425262728293031323334
  1. using FreeSql.DataAnnotations;
  2. using Newtonsoft.Json;
  3. using System.ComponentModel;
  4. using ZhonTai.Admin.Core.Attributes;
  5. namespace ZhonTai.Admin.Core.Entities;
  6. public interface IEntity<TKey>
  7. {
  8. /// <summary>
  9. /// 主键Id
  10. /// </summary>
  11. TKey Id { get; set; }
  12. }
  13. public interface IEntity : IEntity<long>
  14. {
  15. }
  16. public class Entity<TKey> : IEntity<TKey>
  17. {
  18. /// <summary>
  19. /// 主键Id
  20. /// </summary>
  21. [Description("主键Id")]
  22. [Snowflake]
  23. [Column(Position = 1, IsIdentity = false, IsPrimary = true)]
  24. [JsonProperty(Order = -2)]
  25. public virtual TKey Id { get; set; }
  26. }
  27. public class Entity : Entity<long>
  28. {
  29. }