I'm using Fluent NHibernate and need to get my Connection String from the connection.connection_string property on hibernate.cfg.xml file to create my Session Factory:
private static ISessionFactory SessionFactory {
get {
return = Fluently.Configure()
.Database(MySQLConfiguration.Standard.ConnectionString(c => c.FromConnectionStringWithKey("MyConnStr")))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<FooMap>())
.ExposeConfiguration(c => c.Properties.Add("hbm2ddl.keywords", "none"))
.BuildSessionFactory();
}
}
I want to replace MyConnStr (that is in my web.config file) "c => c.FromConnectionStringWithKey("MyConnStr")" for the connection string from the hibernate.cfg.xml file.
I've tried use NHibernate.Cfg.Environment.ConnectionString, but it didn't work.
How can I get this?
Thank you.