SmartSql icon indicating copy to clipboard operation
SmartSql copied to clipboard

是否可以让UseTransactionAttribute 可使用在 类上,让类里面所有方法都默认使用事务

Open XiaoHeitu opened this issue 6 years ago • 3 comments

SmartSql version

4.1.25

Database provider and version

Steps to reproduce

Expected result

namespace SmartSql.DyRepository.Annotations { [AttributeUsage(AttributeTargets.Method||AttributeTargets.Class, AllowMultiple = false)] public class UseTransactionAttribute : Attribute { public IsolationLevel Level { get; set; } = IsolationLevel.Unspecified; } }

Actual result

namespace SmartSql.DyRepository.Annotations { [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public class UseTransactionAttribute : Attribute { public IsolationLevel Level { get; set; } = IsolationLevel.Unspecified; } }

Stack trace

XiaoHeitu avatar Sep 03 '19 01:09 XiaoHeitu

UseTransactionAttribute 作用域是 动态仓储接口 , 请使用 SmartSql.AOP 提供的事务注解。 https://github.com/dotnetcore/SmartSql/blob/master/src/SmartSql.AOP/TransactionAttribute.cs

Ahoo-Wang avatar Sep 04 '19 06:09 Ahoo-Wang

SmartSql.AOP.TransactionAttribute.cs 类注解的作用域,你可以尝试写写,然后提供PR。

Ahoo-Wang avatar Sep 04 '19 06:09 Ahoo-Wang

好的。已提交PR

XiaoHeitu avatar Sep 11 '19 03:09 XiaoHeitu