<?xml version="1.0" encoding="iso-8859-1" ?><!-- Created on the 5/24/2013 8:47:49 AM. Opf3 powered. --><rss version="0.91"><channel><title>Opf3 Forum: Identity Map question</title><link>http://www.opf3.com</link><description></description><language>en-US</language><item><pubDate>Wed, 20 Aug 2008 6:12:58 PM GMT</pubDate><title>RE: Identity Map question</title><link>http://www.opf3.com/Opf3/Community/Topic.aspx?Forum=1&amp;Topic=1562</link><description><![CDATA[OMG. I completely forgot about doing that. I will update that in the next days. Until then you could use the one that comes with the download <img src="http://www.chilisoftware.net/Images/Smilies/smile.gif" border="0" alt="Smile" />]]></description></item><item><pubDate>Wed, 20 Aug 2008 5:24:18 PM GMT</pubDate><title>RE: Identity Map question</title><link>http://www.opf3.com/Opf3/Community/Topic.aspx?Forum=1&amp;Topic=1561</link><description><![CDATA[Thanks again for the info.  I've been taking a look at the new XmlTypeMappingProvider and it looks great!  It should make it alot easier to migrate some of my older applications to opf3.  <br/><br/>Do you have any plans on updating the online documentation?]]></description></item><item><pubDate>Wed, 20 Aug 2008 3:40:44 PM GMT</pubDate><title>RE: Identity Map question</title><link>http://www.opf3.com/Opf3/Community/Topic.aspx?Forum=1&amp;Topic=1557</link><description><![CDATA[Hi Al,<br/><br/>I know! Opf3 has been designed to be very open to add new query languages and storages. That was one of the main goals. You could use Opf3 to query and kind of storage that is not limited to ADO.NET, actually.<br/><br/>That has pros and cons. Pros are that Opf3 is very flexible when it comes to add new storages to the framework. And that you can extend it to any query language that you want and your storage understands. Cons are that you can extend it to any query language tha your sotrage understands but Opf3 doesn't...<br/><br/>Therefore the IdentityMap is really only here to make sure you never have two objects in memory that represent the same row in the database.<br/><br/>As said: caching might help you to reduce your roundtrips a lot. If caching would fail and the IdentityMap is enabled you would be sure to only have the same object once in memory :)<br/><br/>Christian]]></description></item><item><pubDate>Wed, 20 Aug 2008 2:22:07 PM GMT</pubDate><title>RE: Identity Map question</title><link>http://www.opf3.com/Opf3/Community/Topic.aspx?Forum=1&amp;Topic=1556</link><description><![CDATA[Thanks for all the information on what's being done internally - the more the functionality is understood the better decisions we can make determining it's for different scenarios.<br/><br/>Al]]></description></item><item><pubDate>Wed, 20 Aug 2008 1:50:14 AM GMT</pubDate><title>RE: Identity Map question</title><link>http://www.opf3.com/Opf3/Community/Topic.aspx?Forum=1&amp;Topic=1548</link><description><![CDATA[Well it works as this: Opf3 gets a IQuery and asks the command builder to translate this thing somehow into a query that is compatible with the current storage. They do that and Opf3 executes it. Opf3 doesn't know anything about how the query was transformed or what it might contain...<br/><br/>After that the results come back and the objects are populated with the data. From these objects the primary key is taken to check if that one is already in the identity map. If that is true then Opf3 will take the object from the identity map. If that is false the object will be added to the identity map and that one will be returned.<br/><br/>So what is the identity map for? It is in Opf3 to make sure that you always deal with one object in memory. You shouldn't be able to have an object that is represented as one row in the database, represented by different instances in memory.<br/><br/>If you really want to work around loading stuff you should check out the caching features that are build in Opf3. There you could limit yourself to only parse certain queries type and use them understand beforehand if an object should be loaded or not...<br/><br/>Actually if Opf3 would try to understand somehow how the query works it would probably take longer than loading the objects itself from the database.]]></description></item><item><pubDate>Tue, 19 Aug 2008 4:53:23 PM GMT</pubDate><title>RE: Identity Map question</title><link>http://www.opf3.com/Opf3/Community/Topic.aspx?Forum=1&amp;Topic=1546</link><description><![CDATA[</p><div class="ForumQuote"><span class="ForumQuoteTitle">Christian Liensberger wrote: <br /></span>You are right. But in the case of Opf3 where you can use whatever query language you want it is really really hard to understand if the object that is in the identity map would be reloaded or not. Therefore what Opf3 does is understanding what has been loaded (analyzing the vector) and deciding whether to use the instance in the identity map or the one that is fresh and comes from the database.<br/><br/>So far only the primary keys are used to understand if the object is the same. They are the identifier in the table and therefore they are taken into consideration.<br/><br/>Christian</div><p><br/>Okay, So if the various ways of loading were all removed then it could be done.  Of course then you would have very upset folks...  When you you say <br/></p><div class="ForumQuote"><span class="ForumQuoteTitle">Christian Liensberger wrote: <br /></span>So far only the primary keys are used to understand if the object is the same. They are the identifier in the table and therefore they are taken into consideration.<br/></div><p><br/>What is being considered?]]></description></item><item><pubDate>Tue, 19 Aug 2008 4:20:26 PM GMT</pubDate><title>RE: Identity Map question</title><link>http://www.opf3.com/Opf3/Community/Topic.aspx?Forum=1&amp;Topic=1543</link><description><![CDATA[You are right. But in the case of Opf3 where you can use whatever query language you want it is really really hard to understand if the object that is in the identity map would be reloaded or not. Therefore what Opf3 does is understanding what has been loaded (analyzing the vector) and deciding whether to use the instance in the identity map or the one that is fresh and comes from the database.<br/><br/>So far only the primary keys are used to understand if the object is the same. They are the identifier in the table and therefore they are taken into consideration.<br/><br/>Christian]]></description></item><item><pubDate>Tue, 19 Aug 2008 2:45:55 PM GMT</pubDate><title>RE: Identity Map question</title><link>http://www.opf3.com/Opf3/Community/Topic.aspx?Forum=1&amp;Topic=1542</link><description><![CDATA[But isn't the goal of the IdentityMap to reduce trips to the db by checking to see if the object is already loaded and return it?  I can certainly see a benefit to ensuring you are always looking at the latest copy but I thought that was the trade-off for less database hits?<br/><br/>I could see lots of questions on this.What type of check is done? Checksum or a property by property?  If I've changed a value of an object and the object is reloaded with different values - what is returned?<br/><br/>I realize that these issues are things that would have to be dealt with in all systems. But I thought the main benefit of the IdentityMap was that it dealt with these problems by saying - I'll deal with concurrency only on updates/deletes of data only.  <br/><br/>-Al<br/><br/>]]></description></item><item><pubDate>Tue, 19 Aug 2008 1:20:22 AM GMT</pubDate><title>RE: Identity Map question</title><link>http://www.opf3.com/Opf3/Community/Topic.aspx?Forum=1&amp;Topic=1541</link><description><![CDATA[Hi Alfred,<br/><br/>right now Opf3 will still go and call the database. The checking if it is the same object happens only in memory. That is done because it is literally impossible to do it with random queries. In Opf3 everything that implements IQuery could fire a query to a storage...<br/><br/>I hope you understand that.<br/><br/>Chris]]></description></item><item><pubDate>Tue, 19 Aug 2008 12:36:56 AM GMT</pubDate><title>Identity Map question</title><link>http://www.opf3.com/Opf3/Community/Topic.aspx?Forum=1&amp;Topic=1540</link><description><![CDATA[Below is a snippet of a simple test I did to use the new IdentityMap feature, which isn't working for me - although it's highly possible it's user error! <img src="http://www.chilisoftware.net/Images/Smilies/biggrin.gif" border="0" alt="Big Grin" /><br/><br/></p><div class="ForumCode"> //Code to create context removed....(regulare context w/ md5 concurrency....<br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;//Since it's not enabled by default<br/>&nbsp;&nbsp;context.IdentityMap.Enabled = true;&nbsp;&nbsp;<br/> <br/> //Get every widget with an id greater than 1<br/> ObjectSet<Widget> widgets = context.GetObjectSet<Widget>("ID>{0}",1);<br/><br/> //Get the first widget which will require a trip to the database.<br/> Widget w1 = context.GetObject<Widget>("ID={0}",1); <br/><br/> //Get another instance of the first widget which should not have to be retrieved <br/> //from the database since it's in memory now.<br/> Widget w2 = context.GetObject<Widget>("ID={0}",1); <br/><br/></div><p><br/>So when I look in the sql profiler I expect 2 calls to the db.  One for the Objectset with the greater than.  The second for w1.  I am still getting a call to the db for w2 however even though it should be in the IdentityMap shouldn't it?<img src="http://www.chilisoftware.net/Images/Smilies/huh.gif" border="0" alt="Huh!" />]]></description></item></channel></rss>