TransactionAttribute.cs 739 B

123456789101112131415161718192021222324252627282930313233343536
  1. using FreeSql;
  2. using System;
  3. using System.Data;
  4. namespace ZhonTai.Admin.Core.Attributes;
  5. /// <summary>
  6. /// 启用事物
  7. /// </summary>
  8. [AttributeUsage(AttributeTargets.Method, Inherited = true)]
  9. public class TransactionAttribute : Attribute
  10. {
  11. /// <summary>
  12. /// 事务传播方式
  13. /// </summary>
  14. public Propagation Propagation { get; set; } = Propagation.Required;
  15. /// <summary>
  16. /// 事务隔离级别
  17. /// </summary>
  18. public IsolationLevel IsolationLevel { get; set; }
  19. /// <summary>
  20. /// 数据库注册键
  21. /// </summary>
  22. public string DbKey { get; set; }
  23. public TransactionAttribute()
  24. {
  25. }
  26. public TransactionAttribute(string dbKey)
  27. {
  28. DbKey = dbKey;
  29. }
  30. }