Hello,
What I need is to be able to map both foreign key and a reference to a
parent object. For example:
class Parent
> int ParentID
> List<Child> Children
>
>
> class Child
> int ChildID
> int ParentID // foreign key
> Parent ParentEntity
>
> class ParentMap
> HasMany(x => x.Children)
> .KeyColumn("ParentID ") // PROBLEM!
> .Inverse()
> .Cascade.All();
>
> class ChildMap
> Map(x => x.ParentID); // PROBLEM!
> References(x => ParentEntity);
The reason behind this is that operations are done in a detached
environment, and the detached environment doesn't "know" about NHibernate,
so solutions like ChildEntity.ParentEntity = Sessions.Load(parentEntityID)
are not acceptable. We explicitly need to work with the foreign key as a
property. Any help very appreciated
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/nhusers/-/N_DtcB-aiVcJ.
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.