dotnetcore / SmartSql

SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
https://smartsql.net/
Apache License 2.0
1.1k stars 222 forks source link

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

Open XiaoHeitu opened 5 years ago

XiaoHeitu commented 5 years ago

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

Ahoo-Wang commented 5 years ago

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

Ahoo-Wang commented 5 years ago

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

XiaoHeitu commented 5 years ago

好的。已提交PR