<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Entity Cloner</title><link>http://msmvps.com/blogs/matthieu/archive/2008/05/31/entity-cloner.aspx</link><description>I do an EntityCloner which can Clone an entity single or all the graph from one entity. To clone an entity, I use reflection but the problem of Reflection is it’s far. The way to Clone a product is always the same. So I generate a Delegate on the fly</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>Optimistic Concurrency Updates using Entity Framework in N-Tier and N-Layer Applications (Part 2)</title><link>http://msmvps.com/blogs/matthieu/archive/2008/05/31/entity-cloner.aspx#1652274</link><pubDate>Tue, 28 Oct 2008 16:21:45 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1652274</guid><dc:creator>Cesar da la Torre Blog </dc:creator><description>&lt;p&gt;This is my second post about &amp;quot;Updating data using Entity Framework in N-Tier and N-Layer Applications&amp;quot;&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1652274" width="1" height="1"&gt;</description></item><item><title>Optimistic Concurrency Updates using Entity Framework in N-Tier and N-Layer Applications (Part 2)</title><link>http://msmvps.com/blogs/matthieu/archive/2008/05/31/entity-cloner.aspx#1652152</link><pubDate>Mon, 27 Oct 2008 19:58:17 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1652152</guid><dc:creator>Cesar da la Torre Blog  </dc:creator><description>&lt;p&gt;This is my second post about &amp;quot;Updating data using Entity Framework in N-Tier and N-Layer Applications&amp;quot;&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1652152" width="1" height="1"&gt;</description></item><item><title>Optimistic Concurrency Updates using Entity Framework in N-Tier and N-Layer Applications (Part 2)</title><link>http://msmvps.com/blogs/matthieu/archive/2008/05/31/entity-cloner.aspx#1646850</link><pubDate>Fri, 05 Sep 2008 04:52:07 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1646850</guid><dc:creator>External Aggregated Posts</dc:creator><description>&lt;p&gt;This is my second post about &amp;quot;Updating data using Entity Framework in N-Tier and N-Layer Applications&amp;quot;&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1646850" width="1" height="1"&gt;</description></item><item><title>Optimistic Concurrency Updates using Entity Framework in N-Tier and N-Layer Applications (Part 2)</title><link>http://msmvps.com/blogs/matthieu/archive/2008/05/31/entity-cloner.aspx#1646822</link><pubDate>Thu, 04 Sep 2008 23:09:56 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1646822</guid><dc:creator>Cesar de la Torre - BLOG </dc:creator><description>&lt;p&gt;This is my second post about &amp;quot;Updating data using Entity Framework in N-Tier and N-Layer Applications&amp;quot;.&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1646822" width="1" height="1"&gt;</description></item><item><title>re: Entity Cloner</title><link>http://msmvps.com/blogs/matthieu/archive/2008/05/31/entity-cloner.aspx#1646339</link><pubDate>Sun, 31 Aug 2008 18:26:46 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1646339</guid><dc:creator>Matthieu MEZIL</dc:creator><description>&lt;p&gt;Strange, can you send me a code project with this exception please.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1646339" width="1" height="1"&gt;</description></item><item><title>re: Entity Cloner</title><link>http://msmvps.com/blogs/matthieu/archive/2008/05/31/entity-cloner.aspx#1646267</link><pubDate>Sat, 30 Aug 2008 09:23:44 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1646267</guid><dc:creator>Dale</dc:creator><description>&lt;p&gt;Hi Matthieu, &lt;/p&gt;
&lt;p&gt;I&amp;#39;m using your code, the method Clone is okay, but the method CloneWithGraph throw an exception: &amp;quot;The EntityKey property can only be set when the current value of the property is null.&amp;quot;, what does it mean ? and how to work around with this ?&lt;/p&gt;
&lt;p&gt;please help&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1646267" width="1" height="1"&gt;</description></item><item><title>re: Entity Cloner</title><link>http://msmvps.com/blogs/matthieu/archive/2008/05/31/entity-cloner.aspx#1646252</link><pubDate>Sat, 30 Aug 2008 06:37:04 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1646252</guid><dc:creator>Matthieu MEZIL</dc:creator><description>&lt;p&gt;Can you send me your project at matthieu.mezil@winwise.fr please.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1646252" width="1" height="1"&gt;</description></item><item><title>re: Entity Cloner</title><link>http://msmvps.com/blogs/matthieu/archive/2008/05/31/entity-cloner.aspx#1646245</link><pubDate>Sat, 30 Aug 2008 03:03:49 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1646245</guid><dc:creator>Dat Dinh</dc:creator><description>&lt;p&gt;It does not work with mine, the exception is:&lt;/p&gt;
&lt;p&gt;&amp;quot;The method or operation is not implemented.&amp;quot;&lt;/p&gt;
&lt;p&gt;please help me to work around with this, thanks&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1646245" width="1" height="1"&gt;</description></item><item><title>re: Entity Cloner</title><link>http://msmvps.com/blogs/matthieu/archive/2008/05/31/entity-cloner.aspx#1645055</link><pubDate>Tue, 19 Aug 2008 12:16:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1645055</guid><dc:creator>Matthieu MEZIL</dc:creator><description>&lt;p&gt;I am sorry, I don&amp;#39;t understand the question. What does asm mean? assembly?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1645055" width="1" height="1"&gt;</description></item><item><title>re: Entity Cloner</title><link>http://msmvps.com/blogs/matthieu/archive/2008/05/31/entity-cloner.aspx#1645026</link><pubDate>Tue, 19 Aug 2008 08:11:07 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1645026</guid><dc:creator>sniddy</dc:creator><description>&lt;p&gt;what kind of asm is that? ... &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1645026" width="1" height="1"&gt;</description></item><item><title>re: Entity Cloner</title><link>http://msmvps.com/blogs/matthieu/archive/2008/05/31/entity-cloner.aspx#1631032</link><pubDate>Wed, 04 Jun 2008 08:22:08 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1631032</guid><dc:creator>Matthieu MEZIL</dc:creator><description>&lt;p&gt;Without your code, it's hard to know why you have a bug but I update my method. I replace some cloneILGenerator.Emit(OpCodes.Ldloc_S, value) by cloneILGenerator.Emit(OpCodes.Ldloc, value).&lt;/p&gt;
&lt;p&gt;Say me please if it works fine now and if no and if it's possible, send me your code please.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Matthieu&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1631032" width="1" height="1"&gt;</description></item><item><title>re: Entity Cloner</title><link>http://msmvps.com/blogs/matthieu/archive/2008/05/31/entity-cloner.aspx#1630613</link><pubDate>Tue, 03 Jun 2008 10:12:46 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1630613</guid><dc:creator>Matthieu MEZIL</dc:creator><description>&lt;p&gt;Thanks for feed back.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I use Nortwind DB. In My EDM, I include only Category et Product tables. I do simply this for my test:&lt;/p&gt;
&lt;div style="FONT-SIZE:10pt;BACKGROUND:white;COLOR:black;FONT-FAMILY:Courier New;"&gt;
&lt;p style="MARGIN:0px;"&gt;&lt;span style="COLOR:#2b91af;"&gt;Products&lt;/span&gt; p;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&lt;span style="COLOR:#2b91af;"&gt;Categories&lt;/span&gt; c;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&lt;span style="COLOR:blue;"&gt;using&lt;/span&gt; (&lt;span style="COLOR:blue;"&gt;var&lt;/span&gt; context = &lt;span style="COLOR:blue;"&gt;new&lt;/span&gt; &lt;span style="COLOR:#2b91af;"&gt;NorthwindEntities1&lt;/span&gt;())&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;{&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; c = context.Categories.Include(&lt;span style="COLOR:#a31515;"&gt;&amp;quot;Products&amp;quot;&lt;/span&gt;).First();&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; p = c.Products.First();&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:blue;"&gt;var&lt;/span&gt; cLast = context.Categories.Where(cl =&amp;gt; cl.CategoryID == 2).First();&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;}&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&lt;span style="COLOR:blue;"&gt;var&lt;/span&gt; p2 = p.Clone();&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&lt;span style="COLOR:blue;"&gt;var&lt;/span&gt; p3 = p.CloneWithGraph();&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&lt;span style="COLOR:blue;"&gt;var&lt;/span&gt; c2 = c.Clone();&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&lt;span style="COLOR:blue;"&gt;var&lt;/span&gt; c3 = c.CloneWithGraph();&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;The problem of&amp;nbsp;ILGenerator.Emit is it&amp;#39;s very hard to debug.&lt;/p&gt;
&lt;p&gt;Matthieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1630613" width="1" height="1"&gt;</description></item><item><title>re: Entity Cloner</title><link>http://msmvps.com/blogs/matthieu/archive/2008/05/31/entity-cloner.aspx#1630606</link><pubDate>Tue, 03 Jun 2008 10:05:33 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1630606</guid><dc:creator>Martin</dc:creator><description>&lt;p&gt;Hi &amp;nbsp;Matthieu &lt;/p&gt;
&lt;p&gt;I am playing with the Cloner code at the moment and finding it very interesting.&lt;/p&gt;
&lt;p&gt;I am geting an error on it at the moment but can&amp;#39;t track it down. Its in the IL section somewhere.&lt;/p&gt;
&lt;p&gt;Do you have an example of how to use the Cloner in an application as I may be doing it incorrectly?&lt;/p&gt;
&lt;p&gt;Its fantastic work and I would love to see it running, if you can help that would be fantastic.&lt;/p&gt;
&lt;p&gt;many thanks&lt;/p&gt;
&lt;p&gt;Martin &lt;/p&gt;
&lt;p&gt;mtrevena@reeds.net.au&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1630606" width="1" height="1"&gt;</description></item></channel></rss>