FelicePollano edited this page Oct 17, 2012 · 8 revisions
Clone this wiki locally

NHWebConsole is an embeddable NHibernate console for web applications. Basically, it gives you a web front-end to your database, using HQL or SQL as querying languages.Here's a video demoing how it looks like and some of the things you can do with it.


  • Issue any select/update/delete using HQL or SQL.
  • Bookmarkable: the whole query is in the querystring, so any query is bookmarkable (except updates and deletes of course).
  • Easily embeddable: A single DLL with no external dependencies (except .Net 3.5 SP1 and NHibernate itself, of course)
  • Easily configurable: you only need to tell the library how to get to the NHibernate Configuration and ISession (or ISessionFactory) at application start, and add the HttpHandler to your web.config.
  • Accesskeys: ALT-Q goes to the query editor, ALT-X executes the query, ALT-, goes to the previous page, ALT-. to the next page. (Firefox uses SHIFT-ALT instead of just ALT)
  • RSS: get updates on your queries.
  • HQL Intellisense (thanks to Felice Pollano)


1. Reference NHWebConsole.dll in your application (you can get it from NuGet for NHibernate 1.2, NHibernate 2.1.2, or NHibernate 3.x )
2. Add it to your httpHandlers in your web.config:
<add verb="*" path="nhconsole/*" validate="false" type="NHWebConsole.ControllerFactory, NHWebConsole"/>
3. Configure it with NHWebConsoleSetup in your Application_Start(), e.g.:

protected void Application_Start(object sender, EventArgs e) {
	var cfg = BuildNHibernateConfiguration();
	var sessionFactory = cfg.BuildSessionFactory();
	NHWebConsoleSetup.OpenSession = () => sessionFactory.OpenSession();
	NHWebConsoleSetup.Configuration = () => cfg;

4. Visit /nhconsole/index.ashx