Hi,
I'm trying to map this model, with Fluent nHibernate, but if someone
can post the right map using nh I hope It will be easier to create the
right fluent mapping:

I'm trying to map a many to many relation with data in the link table:

I'm using the FNH 1.0 RTM.

this is my db:

tblGroups: GroupID GroupName
tblMembersInGroup: GroupID MemberID Rank
tblMembers: MemberID, Name

this is my Model:

class group
{
int groupid
string name
List<EnlistedMember> myMembers;

}

class EnlistedMebmer
{
Member myMember;
int Rank;

}

class Member
{
int MemberID
string Name
....

}

A member can be listed in many groups, in each group he might have a
different rank (or join date or whatever).

I am not sure how to map this in FNH:

I think the group mapping is obvious:

Table(tblGroup);
Id(x => x.groupid, "GroupID').GeneratedBy.Identity();
Map(x => x.name, "GroupName");
HasMany(x => x.myMembers).Table(tblMembersInGroup).KeyColumn
(GroupId).AsList().Inverse().Cascade.All();


What's next ?

notice that the member class has no "group" list object, so can it be
mapped to the linked table without it ?
notice that the link table has a rank inside it - if I follow the
examples of mapping many to many from member class and group class,
how do I map the rank field in the link table ?

Thanks,
Dani

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to