I have my NHibernate configuration successfully set up in my web.config file. However, I am also using ASP.NET Membership which requires a connectionstring to be defined in the connectionStrings element. Is there a way I can make my NHibernate configuration use this value so I don't need to define the connection string twice?
NHibernate Configuration in web.config - use existing connectionstring
5.9k views Asked by Mike Cole At
2
You can use connection.connection_string_name element in the NHibernate configuration. Have a look here. Then NHibernate will get connection string by name from web.config file
You need to use the
connection.connection_string_name
attribute in the configuration:With fluent configuration you can do the following
With NHibernate configuration API you can do the following: