<?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 : Use Entity Manager on server. How?</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Use Entity Manager on server. How?</description>
  <pubDate>Wed, 13 May 2026 08:00:26 -700</pubDate>
  <lastBuildDate>Fri, 30 Mar 2012 06:10:01 -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=3248</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>Use Entity Manager on server. How? : This solution works only for Silverlightapps?...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3248&amp;PID=13167#13167</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1427" rel="nofollow">berardelia</a><br /><strong>Subject:</strong> 3248<br /><strong>Posted:</strong> 30-Mar-2012 at 6:10am<br /><br />This solution works only for Silverlightapps? What about ASP.NET?<br>]]>
   </description>
   <pubDate>Fri, 30 Mar 2012 06:10:01 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3248&amp;PID=13167#13167</guid>
  </item> 
  <item>
   <title>Use Entity Manager on server. How? :   Thank you!I went single-instance...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3248&amp;PID=12628#12628</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1264" rel="nofollow">katit</a><br /><strong>Subject:</strong> 3248<br /><strong>Posted:</strong> 07-Feb-2012 at 3:59pm<br /><br />Thank you!<div>&nbsp;</div><div>I went single-instance per call and it seems like it's working OK</div><div>&nbsp;</div><div>Server is stable, CPU low, all good. It is slowish on response but it is consistently slow which is fine for what I do. Seems like I'm paying tax on object initializations but it's not in system load. Just warm-up time.</div>]]>
   </description>
   <pubDate>Tue, 07 Feb 2012 15:59:18 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3248&amp;PID=12628#12628</guid>
  </item> 
  <item>
   <title>Use Entity Manager on server. How? :   Hi Katit,If you want to play...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3248&amp;PID=12627#12627</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> 3248<br /><strong>Posted:</strong> 07-Feb-2012 at 2:04pm<br /><br />Hi Katit,<div>&nbsp;</div><div>If you want to play safe, your best bet should be having a single EM instance per-call.</div><div>&nbsp;</div><div>Note that after the first request there won't be a really bad overhead&nbsp;while creating an EM each time, since DevForce will have done all its static initialization.</div><div>&nbsp;</div><div>However, if you still think that the performance has drastically decreased, you could try one of the following:</div><div>&nbsp;</div><div>1) use the EM copy constructor to pass credentials from an already logged in EM;</div><div>2) store the EM in a session variable if you expect to have sessions;</div><div>3) create a pool of EMs and grab one from the pool for each request, and then return to the pool when done.</div><div>&nbsp;</div><div>I hope this helps.</div><div>&nbsp;</div><div>Regards,</div><div>&nbsp;&nbsp; Silvio.</div>]]>
   </description>
   <pubDate>Tue, 07 Feb 2012 14:04:01 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3248&amp;PID=12627#12627</guid>
  </item> 
  <item>
   <title>Use Entity Manager on server. How? :   Silvio,I checked &amp;#034;Multithreading&amp;#034;...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3248&amp;PID=12601#12601</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1264" rel="nofollow">katit</a><br /><strong>Subject:</strong> 3248<br /><strong>Posted:</strong> 01-Feb-2012 at 3:03pm<br /><br />Silvio,<div>&nbsp;</div><div>I checked "Multithreading" article on drc, disabling is not really a good solution if it might present issues. I'd rather play safe. Do you have any experience using EntityManager is similar scenario?</div>]]>
   </description>
   <pubDate>Wed, 01 Feb 2012 15:03:27 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3248&amp;PID=12601#12601</guid>
  </item> 
  <item>
   <title>Use Entity Manager on server. How? :   Hi katit,To disable cross-thread...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3248&amp;PID=12600#12600</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> 3248<br /><strong>Posted:</strong> 01-Feb-2012 at 2:58pm<br /><br />Hi katit,<div>&nbsp;</div><div>To disable cross-thread checking, set <em>EntityManager.AuthorizedThreadId = null </em></div><div>&nbsp;</div><div>Regards,</div><div>&nbsp;&nbsp; Silvio.</div>]]>
   </description>
   <pubDate>Wed, 01 Feb 2012 14:58:44 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3248&amp;PID=12600#12600</guid>
  </item> 
  <item>
   <title>Use Entity Manager on server. How? :     I have silverlight application...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3248&amp;PID=12598#12598</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1264" rel="nofollow">katit</a><br /><strong>Subject:</strong> 3248<br /><strong>Posted:</strong> 01-Feb-2012 at 2:40pm<br /><br />I have silverlight application that uses Model on a client.<div>&nbsp;</div><div>I also have mobile clients that connect to the same server (WCF REST)</div><div>&nbsp;</div><div>I'm using EntityManager on server as well but get errors like:</div><div>&nbsp;</div><div><em>An EntityManager can only execute on a single thread. This EntityManager is authorized to execute on the thread with id=’13’; the requested operation came from the thread with Id=‘14’.</em></div><div><em>Consider calling the EntityManager’s asynchronous methods; they work safely on background threads managed by DevForce. </em></div><div><em>You may have to disable this cross-thread checking for specific reasons such as automated testing. Please review our documentation on multi-threading issues and the EntityManager.AuthorizedThreadId property.</em></div><div><em></em>&nbsp;</div><div>What does it mean and how do I work with it? Prior to getting DevForce we used EF and there was no issues like this.&nbsp;We don't want to maintain 2 models with the same stuff and converted to DevForce. </div><div>&nbsp;</div><div>Mobile service looks like this:</div><div>&nbsp;</div><div>&#091;Export&#093;<br>&nbsp;&nbsp;&nbsp; &#091;PartCreationPolicy(CreationPolicy.NonShared)&#093;<br>&nbsp;&nbsp;&nbsp; &#091;ServiceContract&#093;<br>&nbsp;&nbsp;&nbsp; &#091;AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)&#093;<br>&nbsp;&nbsp;&nbsp; &#091;ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)&#093;<br>&nbsp;&nbsp;&nbsp; public class MobileService<br>&nbsp;&nbsp;&nbsp; {</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#091;Import&#093; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public IContextManager ContextManager { get; set; }</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#091;Import&#093;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public IMembershipService MembershipService { get; set; }</div><div>&nbsp;</div><div><br>&nbsp;</div><div>So, that means I'm having instance per call. However my ContextManager and MembershipService shared and I guess this is where the problem is. I understand I can make them non-shared. Or is there other way to solve this problem?</div><div>&nbsp;</div><div>I realize that I probably should do single instance per-call which means I should use NonShared on all of my DI-objects.</div><div>&nbsp;</div><div>I wonder how DevForce will perform in such scenario? I have very light DB calls (small inserts) but there is a lot of calls. Up to 1000 per minute which means&nbsp;I will have to create EntityManager instance every time. Is that a big load? Or it will be fine?</div><div>&nbsp;</div><span style="font-size:10px"><br /><br />Edited by katit - 01-Feb-2012 at 2:51pm</span>]]>
   </description>
   <pubDate>Wed, 01 Feb 2012 14:40:06 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3248&amp;PID=12598#12598</guid>
  </item> 
 </channel>
</rss>