First of all, I am not a user of NHibernate. (Does that mean I shouldn't post in this list?)
Anyway, I am trying to gain better understanding of Identity Map (of Fowler) by finding out how NHibernate does it, if it indeed implements one. I searched and browsed through some of the postings and articles and it seems that there is one implemented but am not clear on how exactly. 1. Does NHibernate require an identity field/property on an object? 2. Most of the examples I found used public get/set for an identity - certainly this is for demonstration purpose, correct? I read somewhere that NHibernate can use reflection to update a private field instead. 3. Related to #2, when you create a new object and so it does not have an id yet, after you persist it, does NHibernate assign the id to the SAME object? 4. If a client has a reference on an object dished out by NHibernate, but NHibernate "refreshes", then when the client tries to "update", will NHibernate recognize it? #4 is where I am stuck with Identity Map pattern. Basically, Fowler's implementation in the book is a basic implementation where the objects are stored in ArrayList and the containment is checked on .net object reference equality. If you had a million objects, let's say, that won't be efficient obviously. But leaving performance/scalability concerns out of the window for now, how does NHibernate deal with object equality? Does it compare by certain id field/property on the objects or via value comparison? or something else? Or is that left to the client side code to deal with? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
