Hello,
I have my persistant classes in outer DLL in directory Plugins (not the same directory as the main program). When i call
Code:
Assembly module = Assembly.LoadFile(Environment.CurrentDirectory + @"\Plugins\module.dll");
configuration = new Configuration();
configuration.AddAssembly(module);
NHibernate throw an exception, that he can't load a mapping class (file not found).
Reason:Function:
Code:
Configuration.AddAssembly(Assembly assembly)
uses function (connections: AddAssembly > AddValidatedDocument > BindRoot > BindRootClass > BindClass > ClassForFullNameChecked > ClassForName > TypeFromAssembly):
Code:
ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName name, bool throwOnError)
And this function have line (!!) :
Code:
Assembly assembly = Assembly.Load(name.Assembly)
Why NHibernate
loads again the assembly (and loads it from a name, but I gave him a object of type Assembly). Now he searches for the assembly in folder of main program, but my assembly is in folder Plugins.
In my opinion, this is a bug.
KJ