<?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 : Checkbox and Associations</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Checkbox and Associations</description>
  <pubDate>Tue, 14 Apr 2026 20:38:29 -700</pubDate>
  <lastBuildDate>Tue, 29 May 2012 11:21:33 -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=3462</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>Checkbox and Associations : Removing entities from the EntityManager...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3462&amp;PID=13672#13672</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1005" rel="nofollow">mgood</a><br /><strong>Subject:</strong> 3462<br /><strong>Posted:</strong> 29-May-2012 at 11:21am<br /><br />Removing entities from the EntityManager doesn't delete them. It just removes them from the cache. To delete them you have to call the Delete method on the EntityAspect: <DIV></DIV><DIV></DIV><DIV>&nbsp;</DIV><DIV>a.EntityAspect.Delete() or</DIV><DIV>&nbsp;</DIV><DIV>EntityAspect.Wrap(a).Delete() if you do code-first and don't have the EntityAspect property. </DIV><DIV>&nbsp;</DIV><DIV>Now, keep in mind, the entity is still in the cache at this point, marked for deletion. Once you call SaveChangesAsync, the corresponding record will be deleted from the database and then the entity will get removed from the cache. </DIV><DIV>&nbsp;</DIV><DIV>The typical logic for handling checkboxes is if the user unchecks an item, you call EntityAspect.Delete to mark it for deletion. If the user changes their mind and checks it again, you call EntityAspect.RejectChanges, to undelete the entity. </DIV><DIV>&nbsp;</DIV><DIV>If the user checks a new item that hadn't been checked before, you create a new entity and add it to the EntityManger. Now here comes the tricky part. If the user changes their mind, you call EntityAspect.Delete(). Because you called Delete on an Added entity, the entity isn't marked for deletion, but simply detached from the EntityManager, because the entity doesn't exist in the data source yet. So, now if the user changes their mind again and checks the item again, you can either add the detached entity back to the EntityManager with EntityAspect.AddToManager() or you can create an entire new entity and add it. </DIV><DIV>&nbsp;</DIV><DIV>Hope this helps.</DIV><span style="font-size:10px"><br /><br />Edited by mgood - 29-May-2012 at 11:37am</span>]]>
   </description>
   <pubDate>Tue, 29 May 2012 11:21:33 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3462&amp;PID=13672#13672</guid>
  </item> 
  <item>
   <title>Checkbox and Associations : Hello,I go a lot of difficulties...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3462&amp;PID=13668#13668</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1136" rel="nofollow">pponzano</a><br /><strong>Subject:</strong> 3462<br /><strong>Posted:</strong> 29-May-2012 at 8:29am<br /><br />Hello,<br>I go a lot of difficulties with Ideablade and a silverlight application I'm developing.... in the specific I've a <a href="uploads/1136/Untitled.rar" target="_blank">uploads/1136/Untitled.rar</a> that represent an association between script and variables...<br><br>I wish to have a page where the user chooses witch variables is assigned to wich script (I've used a ListBox to represent the variables) <br><br>My first problem is :<br><br>I've got 20 variables ...how do I show the 20 but when saving/loading just show the items that represents the association SCRIPT_VARIABILI? If I bind my template to SCRIPT_VARIABILI I just see the specific, not all the items...<br><br>Second problem :<br><br>I've tought of delete all the SCRIPT_VARIABILI during the save and just to add the checked ones but it doesn't work.... can someone provide me a sample on how to do so?<br>Thanks<br><br>The code I used for deleting is<br><br>public OperationResult DeleteLinkScriptVariables(SCRIPT script,Action onSuccess = null, Action&lt;Exception&gt; onFail = null)<br>        {<br>            foreach (var a in script.SCRIPT_VARIABILI.ToList())<br>            {<br>               // Manager.RemoveEntity(a);<br>             //   a.EntityAspect.RemoveFromManager(true); //no one works...<br>            }<br><br>            EntitySaveOperation op = Manager.SaveChangesAsync();<br>            return op.OnComplete(onSuccess, onFail).AsOperationResult();<br>        }<br><br>Thanks<br>]]>
   </description>
   <pubDate>Tue, 29 May 2012 08:29:33 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3462&amp;PID=13668#13668</guid>
  </item> 
 </channel>
</rss>