If I tried embedding our hibernate.cfg.xml in the Project.Web (Web Role) assembly, the configuration loading wouldn't work. I ended up putting the hibernate.cfg.xml in App_Data in the Project.Web assembly, then when I load my config:
var configuration = new Configuration();var configFilename = "hibernate.cfg.xml";if (HttpContext.Current != null){configFilename= HttpContext.Current.Server.MapPath("~/App_Data/" + configFilename);}configuration.Configure(configFilename);configuration.AddAssembly("Project.Data");return configuration;
In actual fact I'm using hibernate.[dev|tst|prd].cfg.xml and I'm wondering if this is the reason it wouldn't load. In any case, this way seems to be secure so that's all I wanted.
I'm using a modified ISessionBuilder from Jeffrey's blog here http://jeffreypalermo.com/blog/use-this-nhibernate-wrapper-to-keep-your-repository-classes-simple/.
No comments:
Post a Comment