Joined Subclass in separate assemblies

8 views
Skip to first unread message

Bobby Johnson

unread,
Nov 3, 2008, 2:56:36 PM11/3/08
to nhu...@googlegroups.com
I have the following solution project structure:

Application.Core.Entities
Application.Xtend.CustomerName.Entities

In the Core project I have an entity Customer defiend. In the XTend project, I have an entity defined that subclasses Customer. The idea here is that customer X can extended our bases classes to add extra fields or what not.

I am attempting to map this relationship in NHibernate. Using Fluent NHibernate I was able to generate this mapping. But NHib throws the following error:


NHibernate.MappingException: persistent class Application.Entites.xCustomer, Application.Core.Entites not found --->  System.TypeLoadException: Could not load type 'Application.Entites.xCustomer' from assembly 'Application.Core.Entites, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'..

Which makes sense xCustomer is not defiend in the Core lib.

Is it possible to span different assemblies like this? Am I approaching the problem wrong?

--
"The explanation requiring the fewest assumptions is most likely to be correct."

- Occam's Razor
http://en.wikipedia.org/wiki/Occam's_Razor

Jason Meckley

unread,
Nov 3, 2008, 4:15:33 PM11/3/08
to nhusers
Fluent NH is a fairly new project. This feature may not be supported
yet.
spike a test using traditional xml mappings to ensure it works. if it
does fluent NH doesn't support the feature.

I would assume it would not be difficult to create a patch.

On Nov 3, 2:56 pm, "Bobby Johnson" <bobby.john...@gmail.com> wrote:
> I have the following solution project structure:
>
> Application.Core.Entities
> Application.Xtend.CustomerName.Entities
>
> In the Core project I have an entity Customer defiend. In the XTend project,
> I have an entity defined that subclasses Customer. The idea here is that
> customer X can extended our bases classes to add extra fields or what not.
>
> I am attempting to map this relationship in NHibernate. Using Fluent
> NHibernate I was able to generate this mapping<http://gist.github.com/21960>.

Bobby Johnson

unread,
Nov 3, 2008, 5:26:39 PM11/3/08
to nhu...@googlegroups.com
I used Fluent NH to generate my XML mapping files for me. But am using the traditional approach now for testing purposes.

Based on the mapping file I linked, do you have suggestions on what I am doing wrong?

Jason Meckley

unread,
Nov 3, 2008, 9:46:11 PM11/3/08
to nhusers
xCustomer needs the full object name.
name="A.B.C.xCustomer, A"

where A.B.C is the namespace and A is the assembly.

On Nov 3, 5:26 pm, "Bobby Johnson" <bobby.john...@gmail.com> wrote:
> I used Fluent NH to generate my XML mapping files for me. But am using the
> traditional approach now for testing purposes.
>
> Based on the mapping file I linked, do you have suggestions on what I am
> doing wrong?
>
> > > - Occam's Razorhttp://en.wikipedia.org/wiki/Occam's_Razor<http://en.wikipedia.org/wiki/Occam%27s_Razor>

James Gregory

unread,
Nov 4, 2008, 3:47:22 AM11/4/08
to nhu...@googlegroups.com
I believe this discussion has happened in the past on the Fluent-nhib list, all class names should really be assembly qualified names and I guess there are still a few places that haven't been fixed. That's what's happening here, you need the full "namespace.class, assembly" name.

Bobby Johnson

unread,
Nov 4, 2008, 11:09:16 AM11/4/08
to nhu...@googlegroups.com
Thanks Jason! As soon as I read your email, I couldn't believe how obvious it was. I made some modifications to Fluent-nhib and will be submitting a patch later today.

Thanks for pointing out the obvious to me. I really appreciate it.
Reply all
Reply to author
Forward
0 new messages