Entity.cs 687 B

123456789101112131415161718192021222324252627282930313233
  1. using Admin.Core.Common.Attributes;
  2. using FreeSql.DataAnnotations;
  3. using System.ComponentModel;
  4. namespace Admin.Core.Common.BaseModel
  5. {
  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. public virtual TKey Id { get; set; }
  25. }
  26. public class Entity : Entity<long>
  27. {
  28. }
  29. }