We are starting to use nhibernate and have setup a Session Manager to create a new SessionFactory. I need to modify some information the 1st time the app starts.
I open the config file (not app.config) using an XDocument.
<settings> <hibernate-configuration xmlns='urn:nhibernate-configuration-2.2'> <reflection-optimizer use='false'/> <session-factory> <property name='x'>SomeValue</property> </session-factory> </hibernate-configuration> </settings> XDocument xdoc = XDocument.Load(<file>); var x = xdoc.Root.Element('hibernate-configuration');
x is null unless i remove the xmlns. What am I missing?
It looks like you’re calling the element by it’s local name from the null namespace rather than the new namespace you added here:
try this: