jonathan@clearcanvas.ca wrote:
Thanks for the blog links - they were helpful! The solution I have found is that if I put the NHibernate.dll and related libraries in the same folder as my DomainModel.dll, then it is able to resolve the classes.
Actually that isn't the whole story. For the benefit of anyone else who may encounter this issue, I'll describe the full solution.
Originally we had 2 assemblies: the application (call it Application.exe) and the DomainModel.dll. Application.exe had a static reference to NHibernate, but would load DomainModel.dll at runtime using Assembly.LoadFrom("c:\plugins\DomainModel.dll"). However, NHibernate was unable to resolve the classes in DomainModel.dll, because as a statically linked assembly it does not have access to types contained in assemblies loaded with LoadFrom. (See
http://www.gotdotnet.com/team/clr/LoadF ... ation.aspx for more detail).
In order to work around this, we changed Application.exe to Application.dll and created a third assembly (call it Loader.exe) that loads both Application.dll and DomainModel.dll using LoadPath. Then, since Application.dll holds the static reference to NHibernate.dll, NHibernate is also loaded into the LoadPath context, and therefore has access to the types contained in DomainModel.dll.