SqlSugarEntityAttribute.cs 1019 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. namespace Admin.NET.Core;
  2. /// <summary>
  3. /// SqlSugar实体配置特性
  4. /// </summary>
  5. [SuppressSniffer, AttributeUsage(AttributeTargets.Class)]
  6. public class SqlSugarEntityAttribute : Attribute
  7. {
  8. /// <summary>
  9. /// 数据库上下文标识
  10. /// </summary>
  11. public string DbConfigId { get; set; } = SqlSugarConst.ConfigId;
  12. /// <summary>
  13. /// 实体顺序
  14. /// </summary>
  15. public int Order { get; set; }
  16. /// <summary>
  17. /// 默认配置
  18. /// </summary>
  19. public SqlSugarEntityAttribute()
  20. {
  21. }
  22. /// <summary>
  23. /// 配置实体排序
  24. /// </summary>
  25. /// <param name="order"></param>
  26. public SqlSugarEntityAttribute(int order)
  27. {
  28. Order = order;
  29. }
  30. /// <summary>
  31. /// 配置数据库标识和实体排序
  32. /// </summary>
  33. /// <param name="order"></param>
  34. /// <param name="dbConfigId"></param>
  35. public SqlSugarEntityAttribute(int order, string dbConfigId)
  36. {
  37. Order = order;
  38. DbConfigId = dbConfigId;
  39. }
  40. }