Je souhaite utiliser la nouvelle fonctionnalité de transformation web2011 VS2010 pour modifier la chaîne de connexion dans la configuration nhibernate de mon fichier web.config. L'extrait pertinent est quelque chose comme ceci:Comment appliquer la transformation VS2010 web.config à un élément avec un attribut namespace?
<?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>
...
J'ai essayé la transformation suivante sans succès:
<?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>
Le problème semble être dans l'attribut xmlns de l'élément NHibernate configuration.
Quelle devrait être la bonne transformation à remplacer (tester la chaîne de connexion) avec (chaîne de connexion de production) pendant le déploiement?
J'ai déjà essayé, mais l'étape de transformation ne peut pas localiser même le noeud « mise en veille prolongée configuration » ... très probablement en raison de son attribut xmlns . – gschuager
Je sais que je saisis des pailles ici, mais la dernière chose que j'essaierais avant d'abandonner serait d'éliminer cet espace blanc supplémentaire dans l'élément de configuration hibernate afin que les configs correspondent exactement. J'ai modifié mon code ci-dessus pour refléter ce dont je parle. –