You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.1KB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace HealthMonitor.Util.Entities.Interfaces
  7. {
  8. public interface IEntity
  9. {
  10. /// <summary>
  11. /// 获取全局(数据库内)唯一键
  12. /// </summary>
  13. /// <param name="key">需要赋予实体键的值</param>
  14. /// <returns></returns>
  15. string GetUniqueKey(string? key = null);
  16. /// <summary>
  17. /// 获取全局(数据库内)唯一键(通过实体的主键创建,而不会创建随机键)
  18. /// </summary>
  19. /// <returns></returns>
  20. string GetRequiredUniqueKey();
  21. /// <summary>
  22. /// 获取主键(数据表内唯一)
  23. /// </summary>
  24. /// <returns></returns>
  25. string GetPrimaryKey();
  26. /// <summary>
  27. /// 为实体的键(标记了KeyAttribute)属性赋值
  28. /// </summary>
  29. /// <param name="key"></param>
  30. void AssignEntityKey(string key);
  31. /// <summary>
  32. /// 断言实体类参数各个字段值符合要求
  33. /// </summary>
  34. void AssertValidate();
  35. }
  36. }