DCSIMG
Tip of the day on NHibernate: IntelliSense for the hbm files - ArnonA

ArnonA

This blog is mainly about C#, TDD, ATDD and NHibernate

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

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 :-)

Comments

No Comments

Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: