Skip to content
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

Flushing audit data during BeforeTransactionCompletion is forbidden in some cases since NH 5 #7

Closed
IwanowM opened this issue Mar 6, 2019 · 3 comments

Comments

@IwanowM
Copy link

IwanowM commented Mar 6, 2019

According to nhibernate-reference

As of NHibernate v5.0, using transaction scope and trying to use the session connection within AfterTransactionCompletion is forbidden and will raise an exception. If the setting transaction.use_connection_on_system_prepare is false, it will forbid any connection usage from BeforeTransactionCompletion event too, when this event is triggered by a transaction scope commit or rollback.

But, as we can see here AuditProcessManager.cs, only one way to flush audit data is inside BeforeTransactionCompletion.
Now it leads to throwing NHibernate.HibernateException Connection usage is currently disallowed

So, it looks like, we have to serve opportunity of flushing audit data on NH session flush.

@RogerKratz
Copy link
Collaborator

Can you please attach a failing test?
About your last sentence... Is there a suitable ext point or similar for that in NH Core you mean?

@RogerKratz
Copy link
Collaborator

@IwanowM
Dont really follow what the exact problem is. There is some (green) transactionscope tests in envers today.

@RogerKratz
Copy link
Collaborator

Close this one, leave corresponding PR #8 open.

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

No branches or pull requests

2 participants