What structure would you recommend for developing multiple modules that share a common domain?
It's likely that my ModuleA and ModuleB both have common objects, would you typically create another project for the domain, keep the domain in one of the modules and just reference that module from the other or some other approach?
I guess for re-usability a module should be completely self-contained. Is there also any problem with having multiple modules in a single project as per the Cuyahoga.Modules project?
DannyTIt's likely that my ModuleA and ModuleB both have common objects, would you typically create another project for the domain, keep the domain in one of the modules and just reference that module from the other or some other approach?
I'd create another project for the common domain. Don't reference from modules to other modules .
Is there also any problem with having multiple modules in a single project as per the Cuyahoga.Modules project?
That's not a problem.
Thanks, that's what I've gone with. Keeping it all in one project is working well.
Okay, well this started well but I'm now hitting a couple of hurdles.
I originally tried to keep all my modules within one web applicaiton project with this structure:
Cuyahoga.Modules.MyModules
Domain
Dao
MyFirstModule
Web
MyFirstModuleModule.cs
MySecondModule
Web
MySecondModule.cs
This was working fine until I added MySecondModule when I kept getting 'object not set to an instance of a reference' when trying to create a section with the second module.
Now I've split out the common functionality into it's own assembly project and each module as a normal module like so:
Cuyahoga.Modules.MyCommonStuff
Domain
Dao
Cuyahoga.Modules.MyFirstModule
Web
MyFirstModuleModule.cs
Cuyahoga.Modules.MySecondModule
Web
MySecondModule.cs
However, now my common library doesn't seem to be getting the necessary nhibernate functionality to the Dao classes as all of the queries just return a "QueryException expected in:" error. Normally I'd expect this error to be raised when a mapping file is not flagged as embedded resource but this isn't the problem here.
I'm guessing this has something to do with the fact my Common class library is not flagged as an INhibernateModule because it isn't a module at all. Is there something I'm missing or can do to sort this?
Cheers :)
I'm now thinking the problem is that as I've externalised the domain, this is where my .hbm mapping files are, as they're not included in the module's assembly which is what appears to be being added to sessionFactoryHelper.
Are there any hooks I can use to add a non-module assembly or if not any ideas on how best to do so?
DannyTI'm now thinking the problem is that as I've externalised the domain, this is where my .hbm mapping files are, as they're not included in the module's assembly which is what appears to be being added to sessionFactoryHelper.
Are there any hooks I can use to add a non-module assembly or if not any ideas on how best to do so?
Sure, just add the assembly to the Nhibernate configuration in faclities.config (after the Cuyahoga.Core assembly).
martijnbSure, just add the assembly to the Nhibernate configuration in faclities.config (after the Cuyahoga.Core assembly).
Ahhh, so easy! Thanks again :)