adriaanp
adriaanp

Reputation: 2074

How to get the sql query from a NHibernate save

I am trying to create a type of recorded data transaction that I can replay on a different database.

For example I am capturing an order into a system, when I save that I want to be able to "export" a sql script that I can run on another database to create the same order.

I am using NHibernate and I am trying to catch the sql query string for the save operation to save to a file, but with no success.

Upvotes: 3

Views: 2489

Answers (1)

Ariel Popovsky
Ariel Popovsky

Reputation: 4875

Checkout this question: Get executed SQL from nHibernate

I'm not sure if there is a better alternative like an event listener, if not, the IInterceptor approach seems to be the best.

Upvotes: 1

Related Questions