ConfORM – Output XML mappings

5 Set

As described in this post ConfORM doesn’t desirialize xml files into C# objects as many others tools do therefore no xml is produced by default by ConfORM. But many times, for NHibernate users, watching an hbm.xml files is just the simplest way to detect how NHibernate is configured. This the reason why the leatest bits of ConfORM contains a class callled NHibernateMappingsExtensions (inside ConfOrm.UsageExamples project) that is just a util extensions to use in your tests or where you need to see the XML mappings. This class doesn’t do anything special: it serializes instances of HbmMapping objects, that is the NHibernate‘s object holding the mapping information, into xml. The HbmMapping instance is created by the ConfORM Mapper class which a class that any ConfORM‘s users should know very well since it’s one the key pieces of the tool (I’ll blog about it soon).

NHibernateMappingsExtensions usage it very simple. Copy & paste this class inside your test project and write down a test that set up ConfORM correctly

and finally call the method AsString() if you want to see all the xml in the output console like this

or call the method WriteAllXmlMapping() if you want a single .hbm.xml file for each domain object on the disk

You could find more samples of this two methods in the ConfOrm.UsageExamples project.



Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:


Stai commentando usando il tuo account Chiudi sessione /  Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )


Connessione a %s...

%d blogger hanno fatto clic su Mi Piace per questo: