NHibernate: How to use with SQL Server Delayed Durability?

New in SQL Server 2014 is Delayed Durability.

It is usually best to use this at the transaction level (to use on specific transactions that need speed and can tolerate small change of data loss).

We use NHibernate 3.2. Is there a straightforward way to add the delayed durability tag to commits:

COMMIT TRANSACTION WITH (DELAYED_DURABILITY = ON);

at a transactional level? For example in some places where I want it, not everywhere.

Upvotes: 0

Views: 105

Answers (1)

Doan Van Tuan
Doan Van Tuan

Reputation: 525

NHibernate uses IDbTransaction.Commit() directly, so you will have to issue the commit yourselves using native SQL. Doing so would interfere with many other mechanisms in NHibernate like events, interceptors... so I think it's not the correct way to do.

Personally I don't understand why Microsoft chose such a syntax without provided another way to do that. I expect that there should be a command like SET TRANSACTION DURABILITY DELAYED that can be issued before commit, but there isn't.

Upvotes: 1

Related Questions