SqlSugarEntityAttribute.cs 1.2 KB

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