I have a existing parent-child relationship I am trying to map in
Fluent Nhibernate:

[RatingCollection] --> [Rating]

Rating Collection has:
- ID (database generated ID)
- Code
- Name

Rating has:
- ID (database generated id)
- Rating Collection ID
- Code
- Name

I have been trying to figure out which permutation of HasMany makes
sense here.  What I have right now:

HasMany<Rating>(x => x.Ratings)
   .WithTableName("Rating")
   .KeyColumnNames.Add("RatingCollectionId")
   .Component(c => { c.Map(x => x.Code);
                               c.Map(x => x.Name); );

It works from a CRUD perspective but because it's a bag it ends up
deleting the rating contents any time I try to do a simple update /
insert to the Ratings property.  What I want is an indexed collection
but not using the database generated ID (which is in the six digit
range right now).

Any thoughts on how I could get a zero-based indexed collection (so I
can go entity.Ratings[0].Name = "foo") which would allow me to modify
the collection without deleting/reinserting it all when persisting?

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