I am working on a legacy code base that builds some of its entities on the fly.I'd like to be able to add these entities to my auto persistent model using AddEntityAssembly
like this :
var model =new AutoPersistenceModel()
.AddEntityAssembly(Manager.RunTimeEntityType.Assembly)
When I try to build a configuration using this model I'm getting a FileNotFoundException
which confuses me because the assembly is already loaded to AppDomain.CurrentDomain
and I can build a new object of RunTimeEntityType
using Activator.CreateInstance
Do I have to do something extra ?
OK. I found out what the problem was.Actually NHibernate had to load this assembly from a different folder that was not introduce as part of the references path.So all I had to do was to add this folder to app.config :
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="my folder name" />
</assemblyBinding>
</runtime>
Here there's a question about the same issue.