Try

// A Mapping
HasMany(x => x.collectionOfBs)
.KeyColumns.Add("id")
.Inverse()
.AsSet();

// B Mapping
References(x => x.A)
.Column("main_a_id");

A doesn't need to know what B calls the foreign key.

Hope this helps,
Maggie

On May 19, 10:11 am, "field1...@libero.it" <field1...@libero.it>
wrote:
> Hi guys,
> here my problem:
>
> i got 2 tables,
>
> A
> id
> name
>
> B
> id
> main_a_id
> referenced_name
>
> i need to map a collections of B for A
> such as
>
> HasMany(x => x.B)
>    .KeyColumn("id")
>    .AsSet();
>
> but i need to specify that the foreign key for B is main_a_id.
>
> How could i can do it?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Fluent NHibernate" group.
> To post to this group, send email to fluent-nhibern...@googlegroups.com.
> To unsubscribe from this group, send email to 
> fluent-nhibernate+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/fluent-nhibernate?hl=en.

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

Reply via email to