Hi,
I've run into a problem, it might just be that I'm not understanding
something. A quick rundown of my domain model. I've got an Entity
class that is not mapped, and several derived classes that are
mapped. I have a class with a "TargetEntity" property that can refer
to any type of Entity. So I need an <any> mapping here, right? I
created the following mapping, but it looks like
<any name="TargetEntity" meta-type="System.String" id-
type="System.Guid">
<meta-value class="Eg.SomeEntity, Eg" value="SomeEntity"/>
<meta-value class="Eg.Person, Eg" value="Person"/>
<column name="TargetEntityType"/>
<column name="TargetEntityID"/>
</any>
So I have a class Person that derives from Entity. If I save a record
with a Target Person, everything is fine. But I have a class, User,
that is derived from Person and mapped as a joined-subclass to
Person. I sort of assumed that if I specified a meta-value for the
<class> at the root of any mapped class hierarchy, NHibernate would be
able to save any type in that hierarchy, sort of fitting with the way
polymorphic queries work for non-mapped classes, but it doesn't appear
that's the case. Does this mean I'd need to specify a <meta-value>
for any possible derived type that could end up in TargetEntity? This
would be over 200 different values, and I'd need to constantly keep
this <any> relationship updated with new releases.
Any thoughts? If the above is all correct, I need to come up with
another solution since the maintainability of the above would be
unworkable. If I have to come up with a different solution, does
anyone have any suggestions? I need the full entity there in the
Target property, so I can't just change that to a TargetID Guid
property.
Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---