The official Fatica Labs Blog! RSS 2.0
# Wednesday, 19 May 2010

In the spirit of “Release early. Release often. And listen to your customers” ( cit. ), even if not so early in term of time since the preview, I decided to release a first drop of the “HQL Intellisense thing” I’m working on. The current version is just able to load an existing mapping assembly, a configuration, help us to write an hql query, submit it to NH and see some results. Here an overall screenshot:


To use it you need to download the bits, and then “create a project” a project is, in the NH Workbench world, a bounch of file representing what we are working on ( and actually is a project in the MSBUILD world. To use the tool now we need at least a working NH configuration file ( your app.config or web config ) and one or more mapping assembly(ies). You add the files to the project by right clicking the project tree:s2

After you added the file you can save the project, so it can be reopened when needed. Please note that the mapping assembly has to be opened from a location containing all the required dependencies ( usually the application folder, or the bin folder ).

After the project is created, you need to compile it before starting to write the queries:


You can compile the project by clicking the button on the toolbar as shown in the picture Fig3




Compiling the project should produce a report in the log area:


If you find the report too verbose, you can uncheck some of the button in the log toolbar. After a successful compilation, we can open a query (hql) document:


This will open a pane in the document area in which we can write HQL queries with some intellisense/auto-completion. Plaese note that, for have the entity completion, after the “from” keyword we need to press ctrl+space to see the completion combo.








Here an example HQL document. After a valid query is done we can submit it to NH and see the result:


The “play” button is enabled only if a valid query ( no errors ) is written in the document. The first and count places are useful to limit the query results.

s7 By pressing the play button, you will be able to se the query results ( if any ):


Next steps:

  • Solve the bugs till now
  • Add supports for hbm2net, so user can write mapping and immediately see it at works.

Enjoy !

Wednesday, 19 May 2010 16:30:52 (GMT Daylight Time, UTC+01:00)  #    Comments [10] - Trackback
Code GEneration | NHibernate

Thursday, 20 May 2010 08:35:11 (GMT Daylight Time, UTC+01:00)
great great stuff!!
Amazing job Felix! Tnx for this!
Saturday, 22 May 2010 15:30:04 (GMT Daylight Time, UTC+01:00)
I think it will be really nice to be able to start up the workbench from my code, then pass it an already configured configuration. The application that starts up the workbench should had already establish any database connection/event listeners in place.
Tran Ngoc Van
Saturday, 22 May 2010 20:28:44 (GMT Daylight Time, UTC+01:00)
Please explain better: you want to inject the benchmark in your running application ?
Sunday, 23 May 2010 08:09:55 (GMT Daylight Time, UTC+01:00)
Yes and no. It may be hard for the workbench to actively inject into another application. I want my app to actively start up workbench and pass it the configuration.

It's like NHProfiler from Ayende. For NHProfiler, your app call a method from NHProfiler's appender dll and the NHProfiler will be able to monitor NHibernate sessions. I don't really need the workbench to run as a separate process (which involves troublesome remoting stuff), something like Workbench.ShowDialog(Configuration cfg) will do.

This way, instead of compiling the project in workbench, I can:
- Reuse the configuration code already exists in my application.
- Avoid any different between my application's initialization and workbench's configuration (ex: why it runs in workbench but not in my app, or vice versa).
Tran Ngoc Van
Sunday, 23 May 2010 08:40:07 (GMT Daylight Time, UTC+01:00)
I think I got your idea. I think it would be not so hard to do, easier than in NH Workbench itself because we will not need to create a separated AppDomain, just use the one in the application. I will try as soon I complete the first release in my mind: being able to drop some mapping and run without need on writing any class neither a database. So user can exports artifacts and use into the application.
Monday, 24 May 2010 16:57:14 (GMT Daylight Time, UTC+01:00)
Thanks for the hard work Felix. I second what Tran is proposing. I would also find this very useful.

Thursday, 27 May 2010 21:10:00 (GMT Daylight Time, UTC+01:00)
Hi Felice, I've implemented a Debugger Visualizer for Visual Studio to display the workbench editor for any Configuration instance.

The code is currently at It's quite useless at the moment but I'll add more feature when I find time.
Tran Ngoc Van
Friday, 28 May 2010 06:33:33 (GMT Daylight Time, UTC+01:00)
Uhmm, sounds really interesting!
Can you provide some screenshot ?
BTW The nhworkbench components is supposed to be easy to reuse, and using i n some way integrated in VS could be a nice idea. Please let me see your progress, and perhaps you want join the project on SourceForge ?

Sunday, 30 May 2010 23:54:07 (GMT Daylight Time, UTC+01:00)
Question: will this work with Fluent nHibinate? or just the xml based model?
Monday, 31 May 2010 10:29:49 (GMT Daylight Time, UTC+01:00)
It does not work at the moment, but I'm planning ( since many request ) to allow the Workbench connect in some way to a running application. This should apply to fluent NH as well. Furthermore I'm planning to have some script engine inside to submit portion of experimental code, this would supports both fluent NH and ConfOrm by a testing point of view.
Felice Pollano
All comments require the approval of the site owner before being displayed.
Please login with either your OpenID above, or your details below.
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, strike, strong) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview
My Stack Overflow

Send mail to the author(s) E-mail

profile for Felice Pollano at Stack Overflow, Q&A for professional and enthusiast programmers
About the author/Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2017
Felice Pollano
Sign In
Total Posts: 157
This Year: 0
This Month: 0
This Week: 0
Comments: 124
This blog visits
All Content © 2017, Felice Pollano
DasBlog theme 'Business' created by Christoph De Baene (delarou) and modified by Felice Pollano