My entities are dynamically created using AssemblyBuilder. At the time when
I want to add a map "config.AddMapping(domainMapping);" I am getting an
error "Could not compile the mapping document: mapping_by_code"
deeper in
NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName
name, Boolean throwOnError) -> "Could not load type 'MyDynamicClass' from
assembly 'MyDynamicAssembly, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null'."
As a result I had to attach to my project the open source NHibernate and
change a few lines "\Util\ReflectHelper.cs":
public static bool IsDynamicAssembly { get; set; }
public static System.Type TypeFromAssembly(AssemblyQualifiedTypeName name,
bool throwOnError)
{
...
Assembly assembly = null;
if (IsDynamicAssembly)
{
assembly = AppDomain.CurrentDomain.GetAssemblies().Where(x =>
x.FullName == name.Assembly).SingleOrDefault();
}
else
{
assembly = Assembly.Load(name.Assembly);
}
...
}
My solution is not the best.
I encourage to think on this issue and make changes to the official code.
Thanks.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.