Several weeks ago I asked for some help understanding DM's  
implementation of the Identity Map pattern, but didn't get a response,  
unfortunately. I'd like to kindly ask again :)

See, I like DM a lot -- and I'm attempting to use it for persistence  
in a MUD I'm writing for fun and experience. Something that's very  
important in that kind of environment is that one object only ever  
exists to represent one database row, or we end up with things like  
two players in "the same room", but the Ruby Player objects are  
actually referencing two different Room objects.

With the Identity Map pattern, I thought I wouldn't have this problem  
-- I thought that this would be true:

     Player.get(1).object_id == Player.get(1).object_id

Not so. I found that I had to do something like this:

     repository(:default) do
          Player.get(1).object_id == Player.get(1).object_id
     end

This works, but I don't think I can use that in any useful way in my  
game... I've attempted to read the code and try to figure out why it  
works this way, but what would help immensely is a little bit of  
narrative about the "why" behind this implementation. I'm guessing it  
has something to do with threading but I'm just not experienced enough  
to figure it all out on my own.

A "Spotlight On Identity Map" would be awesome, too :) but really I'm  
just looking for a quick kick start so that I can wrap my head around  
the code and maybe create my own adapter or something that alters this  
behavior, if that's even possible.

Thanks!

Brent

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" 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/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to