To reproduce:
1. Create assembly ModelEntity.dll
2. Put this assembly to c:\temp and application startup directory
3. Run the code from VS 2005 using ActiveRecord :
...
Assembly activeRecordAssembly = Assembly.LoadFrom(@"c:\temp\ModelEntity.dll");
ActiveRecordStarter.Initialize(activeRecordAssembly, source);
4. Open Debug / Windows / Output
Observed:
1. Output window indicates that wrong assembly is re-loaded (and initialized by activerecord):
Loaded 'C:\mydir\myapp\bin\Debug\ModelEntity.dll', No symbols loaded.
This causes any attemp to use ActiveRecord to fail.
I'm using c:\temp directory because Vista UAC does not allow to replace assembly in appication directory.
ActiveRecord dynamically builds an NHibernate mapping definition.
Part of that NHibernate mapping is the type information. It's expressed in the usual .NET manner:
fully.qualified.typename, assemblyname
What's happening is that ActiveRecord is building up a mapping for one of types inside your ModelEntity.DLL and defining it like this:
Code:
"Namespace.ModelEntity.ClassName, ModelEntity"
(this is assuming "ModelEntity" is the name of the assembly). As you can see, there's no path information in there (by definition) so I'm guessing when this information is passed to NHibernate, it loads some information using the fully qualified type information above and then normal .NET rules for locating assemblies happens (current directory, then probing paths).
How to fix ?
|