Nhibernate

I

IceMan

Hi,
I am using the configuration object and passing it a Assembly object
to load. The assembly object i pass in is from a dll which is in a
different folder then the Nhibernate dll.

The AddAssembly(Assembly assembly) function throws me an Error saying
it can't load the configuration hbm.xml file because it can't load the
assembly in the hbm.xml file.

Why does NHibernate try to load the Assembly again??
 
D

Dave Shooter

IceMan said:
Hi,
I am using the configuration object and passing it a Assembly object
to load. The assembly object i pass in is from a dll which is in a
different folder then the Nhibernate dll.

The AddAssembly(Assembly assembly) function throws me an Error saying
it can't load the configuration hbm.xml file because it can't load the
assembly in the hbm.xml file.

Why does NHibernate try to load the Assembly again??


I think NHibernate tries to load the mapping files from the assembly when
using Configuration.AddAssembly(Assembly asm). Has the hbm.xml file been
compiled into the assembly as an Embedded Resource?
 
I

IceMan

I think NHibernate tries to load the mapping files from the assembly when
using Configuration.AddAssembly(Assembly asm). Has the hbm.xml file been
compiled into the assembly as an Embedded Resource?

Yes, i have made the hbm.xml file an embedded resource, and it works
if the nhibernate and the assembly with the mapping file is in the
same folder.

But it appears that NHibernate tries to load the assembly from the
location NHibernate was loaded from.

But i don't understand why the assembly has to be loaded again. As I
am guesing it most allready be loaded when i have been able to create
other types from that assembly.
 
C

chanchitodata

IceMan,

By a quick look in the code of NHibernate(version 1.0.2 though) that i
had on my disk the only calls that NHibernate do with the assembly are

assembly.GetManifestResourceNames() - to get an array of all resources
inside the assembly(to be able to pull out all "hbm.xml" resources)

and

assembly.GetManifestResourceStream( fileName ) to get the stream to a
specific file

NHibernate does not try to reload the assembly.

/chanchitodata
 
I

IceMan

Hi,

I solved the problem by adding a eventhandler to
"AppDomain.CurrentDomain.AssemblyResolve" and looking for the dll my
self

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top