Tip of the day on NHibernate: IntelliSense for the hbm files

January 11, 2011

no comments

If you’re using NHibernate and writing your NHibernate mapping files (*.hbm.xml) by hand, (as opposed to using Fluent NHibernate for example), then you’ll probably be interested in the following tip (unless you already done that 馃檪 )

You can have IntelliSense validation and auto-completion in the XML editor for NHibernate xml files (both the *.hbm.xml and hibernate.cfg.xml) by following the following steps:

1. Inside VS, select XML->Schemas.

2. Click “Add…”

3. Browse to the “Required_bins” folder inside of your NHibernate folder (e.g. “C:\Nhibernate3.0\Required_bins”)

4. Select both “nhibernate-configuration.xsd” and “nhibernate-mapping.xsd” file and click “Open”.

The 2 schemas will be added to the list:

5. Click OK to close the dialog.

Now, open your hbm.xml or hibernate.cfg.xml files, and you’ll enjoy the IntelliSense support.

Note: unfortunately these xsd files don’t have documentation in them, so you won’t see tooltips with help in the IntelliSense, (only automatic completion and validation). I intend to add these support (by copying it directly from NHibernate’s documentation) and will then publish it. If you know that someone already did that please point me out so I won’t work for void.

Stay tuned for other tips 馃檪

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>