Skip to content

Update UnitOfWork.cs #2026

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

BenLampson
Copy link

..临时修改..期望赶紧fix一下..复现方式也挺简单的,

        using var dbTran = xx.CreateUnitOfWork();
        using var tranInstance = dbTran.GetOrBeginTransaction();

do....
tranInstance.commit()

return
...这里销毁就会默认调用rollback,比较离谱

..临时修改..期望赶紧fix一下..复现方式也挺简单的,

            using var dbTran = xx.CreateUnitOfWork();
            using var tranInstance = dbTran.GetOrBeginTransaction();

do....
tranInstance.commit()

return
...这里销毁就会默认调用rollback,比较离谱
@BenLampson BenLampson closed this May 12, 2025
@BenLampson
Copy link
Author

..实测了好几次..还确实是,另外commit也不会触发 Aop.TraceAfter..
而实际上数据库的数据变了已经

@BenLampson BenLampson reopened this May 12, 2025
@BenLampson
Copy link
Author

哦对了,这个只会出现在
using var dbTran = xx.CreateUnitOfWork();
using var tranInstance = dbTran.GetOrBeginTransaction();
混用的场景
单独使用dbTran.Orm没问题

@2881099
Copy link
Collaborator

2881099 commented May 12, 2025

  •            this.Rollback();
    
  •            if(_tranBefore is not null) this.Rollback();    
    

没有看懂效果意图,aop 怎么会影响到 Dispose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants