I am using linq to Nhibernate to fire some select query to data base.
My question is, how do I know, the query generated by Fluent NHibernate?
Fluent NHibernate is another way of mapping or you can say it is an alternative to NHibernate's standard XML mapping files. Instead of writing XML (.hbm.xml files) documents. With the help of Fluent NHibernate, you can write mappings in strongly typed C# code. In Fluent NHibernate mappings are compiled along with the rest of your application.
NHibernate 3.0 introduces the Linq to NHibernate provider, which allows the use of the Linq API for querying with NHibernate. IQueryable queries are obtained with the Query methods used on the ISession or IStatelessSession. (Prior to NHibernate 5.0, these methods were extensions defined in the NHibernate.Linq namespace.)
IQueryable queries are obtained with the Query methods used on the ISession or IStatelessSession. (Prior to NHibernate 5.0, these methods were extensions defined in the NHibernate.Linq namespace.) A number of NHibernate Linq extensions giving access to NHibernate specific features are defined in the NHibernate.Linq namespace.
In this chapter, we will be covering Hibernate Query Language. HQL is shared across both Java's Hibernate and NHibernate. It is the oldest query mechanism along with Criteria. It was implemented very early and it is a string-based query API. You access it through ISession CreateQuery, and it is almost similar to SQL.
With Fluent NHibernate, you can turn on show_sql
like this:
Fluently.Configure() .Database( MsSqlConfiguration.MsSql2005.ShowSql().ConnectionString(...) )...
NHibernate will now print every sql statement to Console.Out
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With