简体   繁体   中英

Web.config settings for multiple Nhibernate projects

I would love to create separate NHibernate projects for the various modules of my application(So I can maintain each independently).Each project will be self contained kinda(mappings,data, persistence manager etc)

I'm confused as to how I can reference these various projects in the main project(MVC5 web app).I'm thinking I have to create a named section for each project in the web.config file but not sure how to go about this.

Any ideas? Sample config settings? Thanks in advance

After a long drawn silence here and much searching, I finally figured what to do, which is basically: Create the modules as separate projects(warehousing mappings for that module). In the main project, while initialing Nhibernate do something like:

NHibernate.Cfg.Configuration configuration = new NHibernate.Cfg.Configuration();

configuration.AddAssembly("project1"); //the assembly that contains the .hbm files for project1
configuration.AddAssembly("project2"); //the assembly that contains the .hbm files for project2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM