469,902 Members | 1,966 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,902 developers. It's quick & easy.

Nhibernate

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??

May 10 '07 #1
4 3104

"IceMan" <an***********@gmail.comwrote in message
news:11*********************@n59g2000hsh.googlegro ups.com...
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?

May 10 '07 #2
On May 10, 2:38 pm, "Dave Shooter"
<alwayskeepitloa...@delete.me.googlemail.comwrot e:
"IceMan" <andreas.sk...@gmail.comwrote in message

news:11*********************@n59g2000hsh.googlegro ups.com...
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?
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.

May 11 '07 #3
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

On May 11, 3:39 am, IceMan <andreas.sk...@gmail.comwrote:
On May 10, 2:38 pm, "Dave Shooter"

<alwayskeepitloa...@delete.me.googlemail.comwrot e:
"IceMan" <andreas.sk...@gmail.comwrote in message
news:11*********************@n59g2000hsh.googlegro ups.com...
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?

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.

May 12 '07 #4
Hi,

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

thanks
On May 12, 6:07 pm, chanchitodata <chanchitod...@gmail.comwrote:
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

On May 11, 3:39 am, IceMan <andreas.sk...@gmail.comwrote:
On May 10, 2:38 pm, "Dave Shooter"
<alwayskeepitloa...@delete.me.googlemail.comwrot e:
"IceMan" <andreas.sk...@gmail.comwrote in message
>news:11*********************@n59g2000hsh.googlegr oups.com...
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?
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.

May 14 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Aquila Deus | last post: by
1 post views Thread by Hoffmania | last post: by
1 post views Thread by erin.sebastian | last post: by
5 posts views Thread by gaddoz | last post: by
reply views Thread by beantaxi | last post: by
1 post views Thread by Alexander Vasilevsky | last post: by
14 posts views Thread by thj | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.