When developing web apps, I sometimes need to poke into the app's database, or try out some query. When it's a SQL Server database, I have Management Studio. But what if it's SQLite? Or Firebird? Even when it's SQL Server, most of my apps use NHibernate and I'm really spoiled by HQL. And if it's a local embedded database, you have to browse and open the db file. Boring. I already have the app URL, that should be enough.
So I built a NHibernate web console. It's kind of like NHibernate Query Analyzer, but more web-oriented. Here's a screencast showing its features:
A couple of features that are not evident from the screencast:
- Bookmarkable: I wanted to able to copy the URL with a query and send it to a teammate: "See, this isn't right". Of course, updates/deletes/inserts are POSTed, not GETted, so no bookmarks.
- Easily embeddable: A single DLL with no external dependencies (except .Net 3.5 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)
Yeah, I know it's butt-ugly and a little rough around the edges, but still it's pretty usable (at least for me).
DISCLAIMER / WARNING: it's up to you to secure this if you put it in a production website! Also, there is no query cancellation, so if you issue a 1M-results query you will effectively kill your app!
UPDATE: just added RSS support for query results.
Cool!! where is hosted the source code ?
ReplyDeleteSorry, I saw it.
ReplyDeleteVery good app.