Robert,
Thanks, yes this is one solution I've arrived at, I've got a protected
property that I map for NH that is just a getter.
ClassB:
ClassA A;
protected virtual long ClassCId{
get{
return A.ClassC.Id
}set{ }
}
I just thought I'd see if there was a better way someone could suggest
On Feb 17, 3:33 pm, Robert Rudduck <[email protected]> wrote:
> NHibernate doesn't care about visibility so you could use internl / private
> / protected properties or just use fields. All of which can be hidden from
> external classes and the reference exsits to keep NH happy.
>
> On Wed, Feb 17, 2010 at 8:33 AM, Alex McMahon <[email protected]> wrote:
> > I have a legacy database that I'm restricted from changing. I have 2
> > related tables that both have a foreign key to the same 3rd table. In
> > my application I'd rather not have this relationship repeated on both
> > classes. But when I don't map this relationship for both classes I get
> > problems as NHibernate does not put the foreign key in the database.
>
> > I'd like it to be like this:
> > TableA:
> > TableBId
> > TableCId
> > (other fields)
>
> > TableB:
> > TableCId
>
> > -----
>
> > ClassA:
> > ClassB B
> > ClassC C
>
> > ClassB:
> > (other fields)
> > //I don't want ClassC referenced here.
>
> > Any idea how I can tell NHibernate to write the foreign key for TableB-
> > >TableC on an insert, with the minimal amount of pollution of my
> > domain model.
>
> > --
> > 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]<nhusers%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
--
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.