NHibernate Software Engineering

web.config transformations for NHibernate

If you’re trying to use web.config transformations in VS 2010 with nHibernate you might be hitting the same issue I’ve been getting the transformation to match the hibernate-configuration node. The reason is because you have to specify an xmlns="urn:nhibernate-configuration-2.2" attribute as part of the configuration:

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
      <property name="connection.connection_string">connection string</property>

To fix, just set the namespace on the target node in the transformation file like this:

<configuration xmlns:xdt=""
      <hib:property xdt:Transform="Replace" xdt:Locator="Match(name)" name="connection.connection_string">your connection string</hib:property>

2 replies on “web.config transformations for NHibernate”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.