我想使用新的 VS2010 web.config 转换功能来更改我的 web.config 文件中 nhibernate 配置中的连接字符串。相关的片段是这样的:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</property>
<property name="connection.connection_string">(test connection string)</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
...
我尝试了以下转换但没有成功:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory>
<property name="connection.connection_string" xdt:Transform="Replace">(production connection string)</property>
</session-factory>
</hibernate-configuration>
</configuration>
问题似乎出在 nhibernate-configuration 元素的 xmlns 属性中。
在部署期间用(生产连接字符串)替换(测试连接字符串)的正确转换应该是什么?