<?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 : Multiple concurrent save operations</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : Community Forum : Multiple concurrent save operations</description>
  <pubDate>Sat, 11 Apr 2026 02:09:53 -700</pubDate>
  <lastBuildDate>Thu, 25 Oct 2012 00:30:30 -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=3707</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>Multiple concurrent save operations :   Hmm, yeah, multithreading...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14967#14967</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1421" rel="nofollow">siko</a><br /><strong>Subject:</strong> 3707<br /><strong>Posted:</strong> 25-Oct-2012 at 12:30am<br /><br />Hmm, yeah, multithreading ... nah, we'll wait for the callback ;) <div>&nbsp;</div>]]>
   </description>
   <pubDate>Thu, 25 Oct 2012 00:30:30 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14967#14967</guid>
  </item> 
  <item>
   <title>Multiple concurrent save operations :   Originally posted by sikoHave...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14966#14966</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> 3707<br /><strong>Posted:</strong> 24-Oct-2012 at 11:48pm<br /><br /><table width="99%"><tr><td class="BBquote"><strong><em>Originally posted by siko</strong></em><br /><br />&nbsp;<div>Have a background worker periodically find all the entities not in 'Unchanged' state, import&nbsp;those into the connected EM, set the state to Unchanged in&nbsp;the disconnected EM&nbsp;and execute commitasync on the connected EM." ...&nbsp;<br></td></tr></table></div><div><br></div><div>You can only safely use an EntityManager from the thread that created it. You'll get an exception if you try to perform certain operations from another thread. The EntityManager is not thread-safe. You can defeat the exception, but you should only do that if you know for sure what you are doing.&nbsp;</div>]]>
   </description>
   <pubDate>Wed, 24 Oct 2012 23:48:43 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14966#14966</guid>
  </item> 
  <item>
   <title>Multiple concurrent save operations :   Originally posted by mgood ......</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14965#14965</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1421" rel="nofollow">siko</a><br /><strong>Subject:</strong> 3707<br /><strong>Posted:</strong> 24-Oct-2012 at 11:38pm<br /><br /><table width="99%"><tr><td class="BBquote"><strong><em>Originally posted by mgood</strong></em><br /><br />...<div></div> I'm wondering, though, what does your application do if the user moves on to the next question and then the previous answer fails to save? Wouldn't you want to wait before letting the user move on to make sure the answer actually saves successfully?<div></div>...</td></tr></table><div>&nbsp;</div><div>*blushes* ehm, I guess you're right about that after all...</div><div>We were on a, at first hidden,&nbsp;quest to defeat the fundamental nature of SL: <span dir="auto">Asynchrony. *blushes some more*.</span></div><div><span dir="auto"></span>&nbsp;</div><div><span dir="auto">In our attempts to have the best application responsiveness, we thought we could just cache everything and have the framework (devforce) do the async synchronization (...)&nbsp;for us. But even there we found out that while the records/entities were saved, they dissappeard from cache (we understand why, and it is logical!) ... so, waiting is essential and OperationResult's and IEnumerable&lt;INotifyCompleted&gt; are the constructs to apply.</span></div><div><span dir="auto"></span>&nbsp;</div><div><span dir="auto">The thought to make our own cache that is always available synchronously, will cause us issues down the line I'm sure and it is just not the type of code I want or need to write. </span></div><div><span dir="auto"></span>&nbsp;</div><div><span dir="auto">But there is still a thought in me that says: "Yes you can! Use&nbsp;two entitymanagers, one in which you read/update/create/delete, but is in disconnected state&nbsp;and one that&nbsp;actually is connected.&nbsp;&nbsp;Have a background worker periodically find all the entities not in 'Unchanged' state, import&nbsp;those into the connected EM, set the state to Unchanged in&nbsp;the disconnected EM&nbsp;and execute commitasync on the connected EM." ... But it is probably not specific enough to reveal issues we will find there....</span></div><div><span dir="auto"></span>&nbsp;</div><div><span dir="auto">So, we'll wait in the mean time ;)</span></div>]]>
   </description>
   <pubDate>Wed, 24 Oct 2012 23:38:00 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14965#14965</guid>
  </item> 
  <item>
   <title>Multiple concurrent save operations : Nice work. Thanks. </title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14876#14876</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1421" rel="nofollow">siko</a><br /><strong>Subject:</strong> 3707<br /><strong>Posted:</strong> 16-Oct-2012 at 11:38am<br /><br />Nice work. Thanks.]]>
   </description>
   <pubDate>Tue, 16 Oct 2012 11:38:14 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14876#14876</guid>
  </item> 
  <item>
   <title>Multiple concurrent save operations : You want to handle sandboxing...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14874#14874</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> 3707<br /><strong>Posted:</strong> 16-Oct-2012 at 10:12am<br /><br />You want to handle sandboxing during dependency injection as is done in TempHire and illustrated here: <DIV>&nbsp;</DIV><DIV><a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/unit-of-work-pattern-and-persistence-ignorance#HAsimpleUnitOfWork" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/unit-of-work-pattern-and-persistence-ignorance#HAsimpleUnitOfWork</A></DIV><DIV>&nbsp;</DIV><DIV>The import attribute ensures with the NonShared creation policy that MEF injects a new instance. This works in conjunction with a provider factory as outlined below, so that MEF can in fact create multiple instances of the EntityManagerProvider.</DIV><DIV>&nbsp;</DIV><DIV><a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/cocktail-entitymanager-provider#HHowtousetheEntityManagerProvider" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/cocktail-entitymanager-provider#HHowtousetheEntityManagerProvider</A></DIV>]]>
   </description>
   <pubDate>Tue, 16 Oct 2012 10:12:23 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14874#14874</guid>
  </item> 
  <item>
   <title>Multiple concurrent save operations : We want to move on, because we...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14872#14872</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1421" rel="nofollow">siko</a><br /><strong>Subject:</strong> 3707<br /><strong>Posted:</strong> 16-Oct-2012 at 9:20am<br /><br />We want to move on, because we are pretty sure the answer will be 'dumped' into a keyless (!) table without any issues. If an issue arises, it probably will be a connection issue, with which we will deal later, when we start thinking about offline scenarios where answers will be buffered till communications are restored. <br /><br />It is more important that the user can progress to the next question and continue the test.<br /><br />Thank you for your helpful responses so far.<br /><br />Something like this should do it?<br />var uow = new TestUnitOfWork(new EntityManagerProvider&lt;AdamMiloEntities&gt;(), _testCache);<br /><br />(The testcache analogous to IGlobalCache in TH, is something we need since we cache certain sets of data to (hopefully) improve performance and avoid async headaches).<br /><br />Thanks again!<br /><br /><span style="font-size:10px"><br /><br />Edited by siko - 16-Oct-2012 at 9:26am</span>]]>
   </description>
   <pubDate>Tue, 16 Oct 2012 09:20:01 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14872#14872</guid>
  </item> 
  <item>
   <title>Multiple concurrent save operations :   Yes, provided you follow the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14871#14871</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> 3707<br /><strong>Posted:</strong> 16-Oct-2012 at 8:57am<br /><br />Yes, provided you follow the advise given in the documention to ensure each UnitOfWork uses a new instance of the EntityManagerProvider in order to be sandboxed.<div>&nbsp;</div><div><a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/unit-of-work-pattern-and-persistence-ignorance#HUnitOfWork" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/unit-of-work-pattern-and-persistence-ignorance#HUnitOfWork</a></div><div>&nbsp;</div><div>Each question should be it's own unit of work. I'm wondering, though, what does your application do if the user moves on to the next question and then the previous answer fails to save? Wouldn't you want to wait before letting the user move on to make sure the answer actually saves successfully?</div>]]>
   </description>
   <pubDate>Tue, 16 Oct 2012 08:57:52 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14871#14871</guid>
  </item> 
  <item>
   <title>Multiple concurrent save operations :   And creating a new unitofwork...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14869#14869</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1421" rel="nofollow">siko</a><br /><strong>Subject:</strong> 3707<br /><strong>Posted:</strong> 16-Oct-2012 at 4:38am<br /><br />And creating a new unitofwork will do just that?]]>
   </description>
   <pubDate>Tue, 16 Oct 2012 04:38:56 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14869#14869</guid>
  </item> 
  <item>
   <title>Multiple concurrent save operations :  No, there is not. One of the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14819#14819</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> 3707<br /><strong>Posted:</strong> 11-Oct-2012 at 8:17am<br /><br />No, there is not. One of the reasons Cocktail does not allow concurrent saves in a single EntityManager is if you have new entities and you do multiple saves, they all will attempt to insert the same records in the database and you end up with duplicates. You have to wait for the save to go through and let DF reconcile the cache once the save succeeds. If you keep modifying the cache while the save operation is still going on you risk inconsistencies.<div><br></div><div>If you want concurrent saves then you need to create a new EntityManager for each question, so you can save the answers concurrently without potential inconsistencies.</div><span style="font-size:10px"><br /><br />Edited by mgood - 11-Oct-2012 at 8:18am</span>]]>
   </description>
   <pubDate>Thu, 11 Oct 2012 08:17:28 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14819#14819</guid>
  </item> 
  <item>
   <title>Multiple concurrent save operations : Hi,  We&amp;#039;re developing a &amp;#039;test...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14816#14816</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1421" rel="nofollow">siko</a><br /><strong>Subject:</strong> 3707<br /><strong>Posted:</strong> 11-Oct-2012 at 2:08am<br /><br />Hi,<br /><br />We're developing a 'test player' that presents questions to the user awaits a response and then saves that response to the db.<br /><br />It happens that when the user responds quickly to question after question, we get the error that the save operation failed because another was still in progress.<br /><br />Is there a way to tell df to queue the operations and quietly handle the commits without throwing exceptions?<br /><br />Thanks]]>
   </description>
   <pubDate>Thu, 11 Oct 2012 02:08:39 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3707&amp;PID=14816#14816</guid>
  </item> 
 </channel>
</rss>