Is there a way to use NHibernate without connecting to a database?

I only need to Nhibernategenerate pure SQL, which I will send to my C functions.

+3
source share
2 answers

Custom Driver
Create a driver that calls your level C, implementing NHibernate.Driver.IDriver.

The SQLite driver is a good place to run since it is the C library. Your IDriver will be almost the same as SQLiteDriver. NHibernate source code will be useful for this .

You will also need an IDbConnection wrapper for your C library. Of the SQLite wrappers, csharp-sqlite has the smallest source, this should be useful.

Odbc
NHibenate ODBC, NHibernate.Driver.OdbcDriver.

+3

. NHibernate SQL ; , (, ). , SQL, .

, show_sql, NHibernate SQL, . , , - NH- . log4net SQL . . , -

RunQueryAndCaptureSql(session.CreateQuery("from Stuff s where s.Thing = 'dude'"));

SQL . , , , , .

, , , NH.

+2

Source: https://habr.com/ru/post/1734561/


All Articles