Search code examples
nhibernatenhibernate-configuration

NHibernate configuration: Configure(pathToXml) vs AddXmlFile(pathToXml)?


What's the difference between

Configuration.Configure(string)//Configure NHibernate using the file specified.

and

Configuration.AddXmlFile(string)//Read mappings from a particular XML file.

?

It looks like the latter's functionality is a subset of the former's, but does anyone care to elaborate?


Solution

  • The first one is to configure dialect, driver and other configurations properties.

    The second is used if you want to append an additional XML mapping (HBM) file to an existing configuration object.

    For example, create a Configuration using FluentNHibernate then append a classic XML mapping (when migrating legacy NH application to FNH, for example).