I am using Fluent NHibernate and should get my connection string from the connection.connection_string property in the hibernate.cfg.xml file to create my Factory session
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 (this is in my web.config file) " c => c.FromConnectionStringWithKey (" MyConnStr ") " for the connection string from hibernate.cfg.xml .
I tried using NHibernate.Cfg.Environment.ConnectionString, but this did not work.
How can i get this?
Thanks.
source share