Fluent NHibernate Joined Subclass in Separate Assemblies
System.TypeLoadException: Could not load type 'Application.Entites.xCustomer' from assembly 'Application.Core.Entites, Version=126.96.36.199, Culture=neutral, PublicKeyToken=null'..
Which makes sense xCustomer is not defined in the Core library. I took my quandary to the NHibernate Users mailing list and StackOverflow. After some helpful suggestions and pointers, I discovered that the solution was so obvious that I am somewhat embarrassed that I couldn't see it.
The hibernate-mapping attributes assembly and namespace are convenient short cuts that allow you to not have to fully qualify your class names. This lets you have the nice mark up , but the name attribute of both class and joined-subclass elements can take a fully qualified assembly name as well.
So the above broken mapping file can be fixed like so:
<joined-subclass name="Application.XTend.CustomerName.Entities.xCustomer, Application.XTend.CustomerName.Entities, Version=188.8.131.52, Culture=neutral, PublicKeyToken=null" table="xCustomer"> <key column="CustomerId" /> <property name="CustomerType" column="CustomerType" length="255" type="String" not-null="true"> <column name="CustomerType" /> </property> </joined-subclass>
This works as I expected it to. So I then took a look at the Fluent-NHibernate source and created a patch complete with working unit tests to resolve the issue and submitted it to the project.
So at the end of the day, I learned something about NHibernate and the Fluent-NHibernate team got a patch to resolve and obscure bug.