I would like to get opinion on the best way to manage the following please. I have an MVC application project, as well as a DomainModel project. The NHibernate mappings and hibernate.cfg.xml
are in the DomainModel project which is referenced in the MVC application. This would normally work fine as all my dataaccess would go through the NHibernate connection.
The problem is that I am using the Sql Membership provider so need access to a connection string from directly within Asp.net MVC.
Question 1
Has anyone had this issue before and what would be the cleanest solution? I want to make sure I only have one place that stores the connectionstring.
Question 2
How would I configure NHibernate with two seperate connections, for Debug and Release with the code
#if DEBUG
connection = configuration.Properties[/*DEBUGconnectionstring-hibernate.cfg.xml*/]
#else
connection = configuration.Properties[/*RELEASEconnectionstring-hibernate.cfg.xml*/]
#endif
Currently the only valid property is connection.connection_string.
How would you get around this?
Thanks.