<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : update &amp; delete problem</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : update &amp; delete problem</description>
  <pubDate>Wed, 15 Apr 2026 19:58:50 -700</pubDate>
  <lastBuildDate>Tue, 12 Jun 2012 10:18:16 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=3491</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>update &amp; delete problem :   rasel,In the earlier post...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3491&amp;PID=13821#13821</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 3491<br /><strong>Posted:</strong> 12-Jun-2012 at 10:18am<br /><br />rasel,<div>&nbsp;</div><div>In the earlier post you were actually creating 2 entities with the same ID. (i.e. not modifying the entity the second time around) </div><div>In that case, you will get a save exception. (unless the IDs are being resolved at the datasource level)</div><div>&nbsp;</div><div>If you want to modify an entity, it must exist in the datasource first. So you'd need to retrieve it, make the changes, and then save back to the datasource:</div><div>&nbsp;</div><div><em>var testEm = new boolEntities(compositionContextName: CompositionContext.Fake.Name);<br>            var testProducts = new Product&#091;&#093; { <br>            new Product {ProductID = 0, Name = "test", Description = "tesr", Price = 12, Category = "test"} };<br>            testEm.AddEntities(testProducts);<br>            testEm.SaveChanges();<br>            testEm.Clear();<br></em></div><div><strong><em>var prod = testEm.Products.FirstOrDefault(p =&gt; p.ProductID == prod.ProductID);</em></strong></div><div><strong><em></em></strong>&nbsp;</div><div><strong><em>prod.Description = "test";</em></strong></div><div><em></em>&nbsp;</div><div><em>SaveResult sr = testEm.SaveChanges(new Product&#091;&#093; {prod});</em></div><div>&nbsp;</div><div>I suggest you visit our <a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/" target="_blank">DevForce Resource Center</a>. There you will have access to several articles and samples that will help better understand how DevForce works.</div><div>&nbsp;</div><div>Regards,</div><div>&nbsp;&nbsp; Silvio.</div>]]>
   </description>
   <pubDate>Tue, 12 Jun 2012 10:18:16 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3491&amp;PID=13821#13821</guid>
  </item> 
  <item>
   <title>update &amp; delete problem : I found the solution: // Act -...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3491&amp;PID=13817#13817</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1470" rel="nofollow">rasel</a><br /><strong>Subject:</strong> 3491<br /><strong>Posted:</strong> 11-Jun-2012 at 11:26pm<br /><br />I found the solution:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Act - update the product <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; testEm.AttachEntity(prod, EntityState.Modified);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SaveResult sr = testEm.SaveChanges();<br><br>]]>
   </description>
   <pubDate>Mon, 11 Jun 2012 23:26:47 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3491&amp;PID=13817#13817</guid>
  </item> 
  <item>
   <title>update &amp; delete problem : Hello sbelini,Thank you for the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3491&amp;PID=13816#13816</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1470" rel="nofollow">rasel</a><br /><strong>Subject:</strong> 3491<br /><strong>Posted:</strong> 11-Jun-2012 at 9:43pm<br /><br />Hello sbelini,<br><br>Thank you for the fast reply. I also found the EntityAspect.Delete method after I posted my message. How about update? What is wrong with my below code?<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Arrange <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var testEm = new boolEntities(compositionContextName: CompositionContext.Fake.Name);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var testProducts = new Product&#091;&#093; { <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new Product {ProductID = 0, Name = "test", Description = "tesr", Price = 12, Category = "test"} };<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; testEm.AddEntities(testProducts);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; testEm.SaveChanges();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; testEm.Clear();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Product prod = new Product { ProductID = 0, Name = "test", Description = "test", Price = 12, Category = "test" };<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Act - update the product <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SaveResult sr = testEm.SaveChanges(new Product&#091;&#093; {prod});<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Assert<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Product pp = testEm.Products.FirstOrDefault(p =&gt; p.ProductID == prod.ProductID);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.IsTrue(pp.Description.Equals("test"));<br><br>]]>
   </description>
   <pubDate>Mon, 11 Jun 2012 21:43:05 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3491&amp;PID=13816#13816</guid>
  </item> 
  <item>
   <title>update &amp; delete problem :   Hi rasel,To delete an entity...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3491&amp;PID=13813#13813</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 3491<br /><strong>Posted:</strong> 11-Jun-2012 at 12:23pm<br /><br />Hi rasel,<div>&nbsp;</div><div>To delete an entity you should use myEntity.EntityAspect.Delete().</div><div>&nbsp;</div><div>You can find details about the <a href="http://drc.ideablade.com/Api&#068;ocumentati&#111;n/IdeaBlade.EntityModel~IdeaBlade.EntityModel.Extensi&#111;ns.EntityAspectExtensi&#111;ns~Delete.html" target="_blank">Delete</a> method and <a href="http://drc.ideablade.com/Api&#068;ocumentati&#111;n/IdeaBlade.EntityModel~IdeaBlade.EntityModel.EntityManager~RemoveEntity.html" target="_blank">RemoveEntity</a> method in our <a href="http://drc.ideablade.com/Api&#068;ocumentati&#111;n/webframe.html" target="_blank">API documentation</a>.</div><div>&nbsp;</div><div>Regards,</div><div>&nbsp;&nbsp; Silvio.</div>]]>
   </description>
   <pubDate>Mon, 11 Jun 2012 12:23:45 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3491&amp;PID=13813#13813</guid>
  </item> 
  <item>
   <title>update &amp; delete problem : Hello,I&amp;#039;m trying Devforce...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3491&amp;PID=13812#13812</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1470" rel="nofollow">rasel</a><br /><strong>Subject:</strong> 3491<br /><strong>Posted:</strong> 11-Jun-2012 at 11:15am<br /><br />Hello,<br><br>I'm trying Devforce with a sample application. I can read from sqlite DB and add records to it but can't update or delete db. I wrote a sample unit test to simulate my delete routine. This test fails and saveresult status is OK-NoOperation. What is wrong with my code?<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Arrange <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var testEm = new boolEntities(compositionContextName: CompositionContext.Fake.Name);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var testProducts = new Product&#091;&#093; { <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new Product {ProductID = 0, Name = "test", Description = "test", Price = 12, Category = "test"} };<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; testEm.AddEntities(testProducts);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; testEm.SaveChanges();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; testEm.Clear();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Product prod = new Product { ProductID = 0, Name = "test", Description = "test", Price = 12, Category = "test" };<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Act - delete the product <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; testEm.Products.EntityManager.RemoveEntity(prod);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SaveResult sr = testEm.SaveChanges();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Assert<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int ct = testEm.Products.Count();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.IsTrue(ct == 0);<br><br><br>]]>
   </description>
   <pubDate>Mon, 11 Jun 2012 11:15:01 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3491&amp;PID=13812#13812</guid>
  </item> 
 </channel>
</rss>