Hello,
I've defined a class "Customer.cs" with its Xml-File "Customer.hbm.xml" in a dynamically loaded Assembly. When I load the Assembly the reference of this Assembly is returned to the main Assembly where you find my hibernate-initialisation.
My Problem is that NHibernate throws the exception
"Could not compile the mapping document: MyProgram.Customer.hbm.xml".
The inner Exception is:
"Could not load file or assembly 'AddIn.Customer.Core' or one of its dependencies."
When I add the Assembly statically it's all okay, but I want to use them dynamically. Do I have to register an assembly in my program before I use Configuration.AddAssembly()-Method in my main Assembly?
Code:
private ISessionFactory SessionFactory
{
get
{
if (_sessionFactory == null)
{
var configuration = new Configuration();
configuration.Configure();
/* _assemblyCollec becomes filled when plugins are loaded */
foreach (Assembly assembly in _assemblyCollec)
{
configuration.AddAssembly(assembly); // <-- here's the exception
}
_sessionFactory = configuration.BuildSessionFactory();
}
return _sessionFactory;
}
}
Thank you very much!
Sandra