HasMany Without Foreign Key

859 views
Skip to first unread message

sternr

unread,
Jan 20, 2010, 4:15:12 AM1/20/10
to Fluent NHibernate
Hey,

I'm in need of creating a HasMany relationship, but the catch is that
since the DataBase scheme was not properly normalized, the column is
not a foreign key.
Is there a way of creating a HasMany relationship based on other
columns or Where clause alone?

Thanks ahead,

--sternr

Hudson Akridge

unread,
Jan 20, 2010, 11:08:14 AM1/20/10
to fluent-n...@googlegroups.com
.PropertyRef("NonPrimaryKeyProperty").etc.era

--
You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group.
To post to this group, send email to fluent-n...@googlegroups.com.
To unsubscribe from this group, send email to fluent-nhibern...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.






--
- Hudson
http://www.bestguesstheory.com
http://twitter.com/HudsonAkridge

sternr

unread,
Jan 20, 2010, 5:08:21 PM1/20/10
to Fluent NHibernate
HasMany doesnt have .Property-Ref, and according to:
http://www.mail-archive.com/fluent-n...@googlegroups.com/msg02954.html
It wouldnt have.

Any other ideas?

Thanks,

--sternr

On Jan 20, 6:08 pm, Hudson Akridge <hudson.akri...@gmail.com> wrote:
> .PropertyRef("NonPrimaryKeyProperty").etc.era
>
>
>
>
>
> On Wed, Jan 20, 2010 at 3:15 AM, sternr <ste...@gmail.com> wrote:
> > Hey,
>
> > I'm in need of creating a HasMany relationship, but the catch is that
> > since the DataBase scheme was not properly normalized, the column is
> > not a foreign key.
> > Is there a way of creating a HasMany relationship based on other
> > columns or Where clause alone?
>
> > Thanks ahead,
>
> > --sternr
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Fluent NHibernate" group.
> > To post to this group, send email to fluent-n...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > fluent-nhibern...@googlegroups.com<fluent-nhibernate%2Bunsubscr­i...@googlegroups.com>


> > .
> > For more options, visit this group at
> >http://groups.google.com/group/fluent-nhibernate?hl=en.
>
> --

> - Hudsonhttp://www.bestguesstheory.comhttp://twitter.com/HudsonAkridge- Hide quoted text -
>
> - Show quoted text -

Hudson Akridge

unread,
Jan 20, 2010, 5:15:57 PM1/20/10
to fluent-n...@googlegroups.com
The code line I posted to you works for a HasMany (HasMany(x=> x.Whatever).AsBag().KeyColumn("ForeignKeyColumn").PropertyRef("ParentPropertyName") ). 

There is a PropertyRef as of build 614. What build are you on? And it should be a property-ref created for the key column element in a HasMany (not the actual HasMany element).

To unsubscribe from this group, send email to fluent-nhibern...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.






--

Hudson Akridge

unread,
Jan 20, 2010, 5:19:24 PM1/20/10
to fluent-n...@googlegroups.com
Also, that post you linked is 9 months old. A lot can happen in that time...

sternr

unread,
Jan 20, 2010, 6:30:44 PM1/20/10
to Fluent NHibernate
Thanks Hudson - moving to build 614 fixed my problem.
Thanks alot!

[CLOSED]

--sternr

On Jan 21, 12:19 am, Hudson Akridge <hudson.akri...@gmail.com> wrote:
> Also, that post you linked is 9 months old. A lot can happen in that time...
>

> On Wed, Jan 20, 2010 at 4:15 PM, Hudson Akridge <hudson.akri...@gmail.com>wrote:
>
>
>
>
>
> > The code line I posted to you works for a HasMany (HasMany(x=>

> > x.Whatever).AsBag().KeyColumn("ForeignKeyColumn").PropertyRef("ParentProper­tyName")


> > ).
>
> > There is a PropertyRef as of build 614. What build are you on? And it
> > should be a property-ref created for the key column element in a HasMany
> > (not the actual HasMany element).
>
> > On Wed, Jan 20, 2010 at 4:08 PM, sternr <ste...@gmail.com> wrote:
>
> >> HasMany doesnt have .Property-Ref, and according to:
>

> >>http://www.mail-archive.com/fluent-n...@googlegroups.com/msg029...

> >> > - Hudsonhttp://www.bestguesstheory.comhttp://twitter.com/HudsonAkridge-Hidequoted text -


>
> >> > - Show quoted text -
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Fluent NHibernate" group.
> >> To post to this group, send email to fluent-n...@googlegroups.com.
> >> To unsubscribe from this group, send email to

> >> fluent-nhibern...@googlegroups.com<fluent-nhibernate%2Bunsubscr­i...@googlegroups.com>
> >> .
>
> >> For more options, visit this group at
> >>http://groups.google.com/group/fluent-nhibernate?hl=en.
>
> > --

Reply all
Reply to author
Forward
0 new messages