Senior |
|
Joined: Thu Feb 09, 2006 1:30 pm Posts: 172
|
By default NHibernate indexes the id by the actual object itself. Therefore you pass in an instance of the object you are trying to retrieve where you have set the primary key values. NHibernate will use that as the id and then load the object you are looking for.
Also keep in mind that whenever you are using composite ids you need to override Equals and GetHashCode. Equals must return true when the ids are the same (regardless of if the references are equal or not) and then GetHashCode must always return the same code for a given id. It is ok for two different ids to return the same code, so long as every time the same id is provided the same code is returned.
Hope that helps.
|
|