<?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 : SaveChanges in IEntityLoginManager.Logout</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : SaveChanges in IEntityLoginManager.Logout</description>
  <pubDate>Thu, 15 Oct 2026 12:51:00 -700</pubDate>
  <lastBuildDate>Wed, 27 Jul 2011 11:14:08 -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=1779</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>SaveChanges in IEntityLoginManager.Logout : Has there been any update on this....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=11313#11313</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=613" rel="nofollow">stephenmcd1</a><br /><strong>Subject:</strong> 1779<br /><strong>Posted:</strong> 27-Jul-2011 at 11:14am<br /><br /><div style=": rgb255, 255, 255; margin-left: 1px; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; font-family: Verdana, Arial, Helvetica, sans-serif; color: rgb0, 0, 0; font-weight: normal; font-size: 12px; line-height: 1.4; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; -: n&#111;ne; ">Has there been any update on this. &nbsp;The temporary workarounds that we've been doing to get around this issue are starting to get more complicated and fragile. &nbsp;It would be really nice if the Thread.CurrentPrincipal, EntityServerSave/QueryInterceptor.Principal, etc. &nbsp;had the correct value - that is, the user that is getting logged off. &nbsp;We're starting to do more things in the IEntityLoginManager.Logout method and we're hitting some walls because of this issue.</div><div style=": rgb255, 255, 255; margin-left: 1px; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; font-family: Verdana, Arial, Helvetica, sans-serif; color: rgb0, 0, 0; font-weight: normal; font-size: 12px; line-height: 1.4; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; -: n&#111;ne; "><br></div><div style=": rgb255, 255, 255; margin-left: 1px; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; font-family: Verdana, Arial, Helvetica, sans-serif; color: rgb0, 0, 0; font-weight: normal; font-size: 12px; line-height: 1.4; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; -: n&#111;ne; ">Thanks,</div><div style=": rgb255, 255, 255; margin-left: 1px; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; font-family: Verdana, Arial, Helvetica, sans-serif; color: rgb0, 0, 0; font-weight: normal; font-size: 12px; line-height: 1.4; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; -: n&#111;ne; ">-Stephen</div>]]>
   </description>
   <pubDate>Wed, 27 Jul 2011 11:14:08 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=11313#11313</guid>
  </item> 
  <item>
   <title>SaveChanges in IEntityLoginManager.Logout : I can do that hack for now. Do...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=7488#7488</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=613" rel="nofollow">stephenmcd1</a><br /><strong>Subject:</strong> 1779<br /><strong>Posted:</strong> 01-Jul-2010 at 5:39pm<br /><br /><P>I can do that hack for now.&nbsp; Do you have an estimate when this will work without a hack?&nbsp; Next release?&nbsp; Some distant future release?</P><DIV>My backup plan was to use the EntityManager.Tag property to stuff some data in (to easily communicate between the LoginManager and the Interceptor) but that didn't work.&nbsp; It appears the EntityManager provided to the Interceptor is a different EntityManger (so the Tag property is always null in the interceptor).&nbsp; Is this the desired behavior?&nbsp; I guess it makes sense (especially when I consider client-side queries, etc.) but I just want to make sure.</DIV>]]>
   </description>
   <pubDate>Thu, 01 Jul 2010 17:39:40 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=7488#7488</guid>
  </item> 
  <item>
   <title>SaveChanges in IEntityLoginManager.Logout : Nice use case. ;) The EntityManager...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=7487#7487</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=477" rel="nofollow">ting</a><br /><strong>Subject:</strong> 1779<br /><strong>Posted:</strong> 01-Jul-2010 at 5:03pm<br /><br />Nice use case. ;)&nbsp; The EntityManager is already considered "logged out" by the time it hits the EntityServerSaveInterceptor.&nbsp; We're investigating the&nbsp;best way to handle this&nbsp;in our code so that this will work.<DIV>&nbsp;</DIV><DIV>If you don't want to move the SaveChanges() code, you could workaround this by creating a ConcurrentDictionary with the thread ID as the key,&nbsp;to pass information from IEntityLoginManager.Logout to the EntityServerSaveInterceptor.&nbsp; Very hackish though...</DIV><DIV>&nbsp;</DIV><span style="font-size:10px"><br /><br />Edited by ting - 01-Jul-2010 at 5:04pm</span>]]>
   </description>
   <pubDate>Thu, 01 Jul 2010 17:03:52 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=7487#7487</guid>
  </item> 
  <item>
   <title>SaveChanges in IEntityLoginManager.Logout : Testing with the latest version...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=7475#7475</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=613" rel="nofollow">stephenmcd1</a><br /><strong>Subject:</strong> 1779<br /><strong>Posted:</strong> 30-Jun-2010 at 4:17pm<br /><br />Testing with the latest version shows that we are now able to call SaveChanges from IEntityLoginManager.Logout - so that's good.&nbsp; However, we've run into some related problems.&nbsp; We have a custom EntityServerSaveInterceptor that checks the Principal property to make sure the user is allowed to save data.&nbsp; In all other places, this works fine but when it's triggered by a call to SaveChanges() in Logout, I can't seem to find the logged in Principal so my Interceptor ends up canceling the request (it assumes the request is malicious).&nbsp; The Principle gets passed correctly as a parameter to IEntityLoginManager.Logout but surprisingly the Principle property on the passed in EntityManager is NULL and the Thread.CurrentPrincipal is some GenericPrincipal - not what I would expect.&nbsp; In the Interceptor, the Principal the same GenericPrincipal and the EntityManager.Principal is NULL (still).&nbsp; <br><br>Is this a bug or am I missing something?&nbsp; Thanks.<br>]]>
   </description>
   <pubDate>Wed, 30 Jun 2010 16:17:42 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=7475#7475</guid>
  </item> 
  <item>
   <title>SaveChanges in IEntityLoginManager.Logout : I just confirmed that this has...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=6911#6911</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=477" rel="nofollow">ting</a><br /><strong>Subject:</strong> 1779<br /><strong>Posted:</strong> 17-May-2010 at 2:16pm<br /><br />I just confirmed that this has been fixed and will make the next release (early June).]]>
   </description>
   <pubDate>Mon, 17 May 2010 14:16:21 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=6911#6911</guid>
  </item> 
  <item>
   <title>SaveChanges in IEntityLoginManager.Logout : I don&amp;#039;t think it willmake...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=6827#6827</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=477" rel="nofollow">ting</a><br /><strong>Subject:</strong> 1779<br /><strong>Posted:</strong> 07-May-2010 at 6:14pm<br /><br />I don't think it will&nbsp;make the upcoming release, so probably the release after that.&nbsp; Sorry for the inconvenience!<DIV></DIV>]]>
   </description>
   <pubDate>Fri, 07 May 2010 18:14:49 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=6827#6827</guid>
  </item> 
  <item>
   <title>SaveChanges in IEntityLoginManager.Logout : Thanks for the reply.That makes...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=6812#6812</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=613" rel="nofollow">stephenmcd1</a><br /><strong>Subject:</strong> 1779<br /><strong>Posted:</strong> 06-May-2010 at 2:13pm<br /><br />Thanks for the reply.&nbsp;&nbsp;That makes sense.&nbsp; When you say that you're "planning" to fix this, do you have any kind of time frame?&nbsp; Is it going to be in the next release or just some future release sometime?<DIV>&nbsp;</DIV><DIV>There are certainly some workarounds to this issue.&nbsp; I don't really want to rely on the client initiating the cleanup...thereby making a two-step logout process.&nbsp; The cleanup that my IEntityLoginManager.Logout method is doing is because of things I do in IEntityLoginManager.Login.&nbsp; So&nbsp;I don't want to expose this kind of implementation details to my client.&nbsp; Plus, calling Logout is something we do as a kind of "last ditch" effort if we detect the browser hosting our Silverlight client is closing.&nbsp; In this case, it's nice to know that, if we can at least fire off the logout message, the cleanup will happen (as opposed to firing off a "Cleanup" call, waiting for that to finish, and then calling Logoff).</DIV>]]>
   </description>
   <pubDate>Thu, 06 May 2010 14:13:57 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=6812#6812</guid>
  </item> 
  <item>
   <title>SaveChanges in IEntityLoginManager.Logout : We ran into some re-entrancy issues,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=6799#6799</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=477" rel="nofollow">ting</a><br /><strong>Subject:</strong> 1779<br /><strong>Posted:</strong> 05-May-2010 at 6:38pm<br /><br />We ran into some re-entrancy issues, so you currently cannot save within this context.&nbsp; We are planning to&nbsp;change&nbsp;it&nbsp;and enable this&nbsp;(or similar) functionality&nbsp;again though.<DIV>&nbsp;</DIV><DIV>Aside from that particular issue, it may make more sense to trigger the cleanup client-side before logging out, either using the client-side EntityManager to save changes or using an InvokeServerMethod.</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Wed, 05 May 2010 18:38:23 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=6799#6799</guid>
  </item> 
  <item>
   <title>SaveChanges in IEntityLoginManager.Logout : After upgrading to DevForce2010,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=6767#6767</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=613" rel="nofollow">stephenmcd1</a><br /><strong>Subject:</strong> 1779<br /><strong>Posted:</strong> 04-May-2010 at 10:44am<br /><br />After upgrading to DevForce2010, we are running into problems calling SaveChanges in our custom implementation of IEntityLoginManager.Logout.&nbsp; The error we get is: "SaveChanges cannot be called from within a Server-hosted EntityManager."&nbsp; <DIV>&nbsp;</DIV><DIV>In DevForce2009, this kind of code worked fine:</DIV><DIV>&nbsp;</DIV><DIV><table width="99%"><tr><td><pre class="BBcode">/// &lt;summary&gt;<BR>/// Logs out the current user.<BR>/// &lt;/summary&gt;<BR>/// &lt;param name="principal"&gt;The currently logged on user.&lt;/param&gt;<BR>/// &lt;param name="entityManager"&gt;A server-side &lt;see cref="EntityManager"/&gt;&lt;/param&gt;<BR>public void Logout(IPrincipal principal, EntityManager entityManager)<BR>{<BR>&nbsp;&nbsp;&nbsp; //Get our domain-specific EntityManager<BR>&nbsp;&nbsp;&nbsp; var em = new DataModelEntityManager(entityManager);</DIV><DIV>&nbsp;&nbsp;&nbsp; // ... clean up after the user ...</DIV><DIV>&nbsp;&nbsp;&nbsp; //Save the changes<BR>&nbsp;&nbsp;&nbsp; em.SaveChanges();<BR>}</pre></td></tr></table></DIV><DIV>&nbsp;</DIV><DIV>Is there some different way that we should be doing this kind of thing in DF2010?&nbsp; It would seem like overkill to new up a completely different EntityManger, connect/login/etc., just to be able to do some DB work on logout.&nbsp; I guess another option would be to fire off a Stored Procedure that does this clean up....although Stored Procedures don't work in this version...</DIV>]]>
   </description>
   <pubDate>Tue, 04 May 2010 10:44:05 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1779&amp;PID=6767#6767</guid>
  </item> 
 </channel>
</rss>