Hi...,
I want to know how to develop Runtime Connection String in App.Config using NHibernate ..So.PLease Help Me..
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pradeep ShetPosted Oct 17, 2014, 9:17 AM
What do you mean by runtime?
You can read the connectionstring from appconfig file with "key" as name
sessionFactory = Fluently.Configure.
Database(MsSqlConfiguration.
MsSql2005.
ConnectionString(Function(c) c.Is(ConfigurationManager.ConnectionString["key"].ConnectionString)).
ShowSql().
MaxFetchDepth(1)).
Mappings(Function(m) m.HbmMappings.AddClasses(GetType(AttestationDeployment),
GetType(DeploymentDestination),
GetType(HistoricalDeploymentReport))).
Mappings(Function(x) x.HbmMappings.AddFromAssembly(Assembly.Load("GeneralMills.BuildAndDeploy.Common"))).
Mappings(Function(m) m.FluentMappings.AddFromAssemblyOf(Of DomainObjectBase)();