Hi Folks..
Here is my situation..
I have an Entity class that has a Notes property which is a collection of Note. Notes is of type IList (and I use ArrayList).
I have a Member class that inherite from Entity and I would like Member class to have a NotesMaraudage collection of Note.
The problem I'm facing is that in the Notes table in the DB, both Notes from Entity and NotesMaraudage collection will have IdEntity set
to the same Id. When loading a Member, how will this work out? I mean how will nhibernate know which note goes to Notes or NotesMaraudage ?
Right now, what I did is create a NoteMaraudage class that inherite from Note (with a discriminator) and used that class for the collection
of NotesMaraudage. That way, nhibernate can use the discriminator value to load notes properly. but NoteMaraudage class is completly emtpy!
Any comments about this would be greatly appreciated.
Also, in the member.aspx page, I display the related information and at the bottom, I list all notes with a modify link. When someone
clicks the link, he is offer to modify the note. Once modified, how can I save it to the DB ? should I use the Session.save(note) directly
or should I go through Member.Notes[index] and change properties there and then save Member ? The latter seems best to me.. but I just
don't know how to find the right index .. should I use something else than a IList for this?
Thanks
|