-
Notifications
You must be signed in to change notification settings - Fork 857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.net 6.0,按照上面的式例,在方法添加Transactional特性,但是没有生效,不是进入事务里,这个是什么原因引起吗? #1239
Comments
我是按照上面的文档进行引用的,上面问题的代码只是其中一部分代码 |
直接使用using IUnitOfWork unitOfWork = _unitOfWorkManager.Begin(isolationLevel: IsolationLevel.Snapshot);是可以使用事务的,现在是想使用特性方式进行使用事务,然后我们这边也按照上面文档,如下: |
因为你是private方法,一般情况下,必须拥有接口,或此方法是public + virtual 具体看AOP要求 |
这跟private方法没有关系吧,我这边试着将其改成public也无法调用特性transalational里面的方法 |
这个例子我这边也试用过,也是不行😓 |
其他方案
增加了 |
我想问一下TransactionalAttribute这个特性是通过什么进行触发的? |
动态代理组件触发的,上面有资料,这是面向切面编程的一种设计。 AOP |
.net 6.0,按照上面的式例,在方法添加Transactional特性,但是没有生效,不是进入事务里,这个是什么原因引起吗?
Service相关代码:
programe.cs代码:
Originally posted by @km93522719 in #289 (comment)
The text was updated successfully, but these errors were encountered: