﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - Crosslight - How to Use Crosslight in Reloading an Entity and its Navigation Properties from Server-Side?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-in-Reloading-an-Entity-and-its-Navigation-Properties-from-Server-Side/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>How to Use Crosslight in Reloading an Entity and its Navigation Properties from Server-Side?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-in-Reloading-an-Entity-and-its-Navigation-Properties-from-Server-Side/</link><pubDate>Thu, 03 Sep 2015 10:21:30 GMT</pubDate><dc:creator>leo.c</dc:creator><description>&lt;p&gt;Hi Jimmy,&lt;/p&gt;&lt;p&gt;For your information, Entity Framework works best when database leaves all the logic to the Entity Framework code. In a case where your database trigger was complex and required more time, you could adopt one of below options:&lt;/p&gt;&lt;p&gt;1. Let Entity Framework to handle all complex trigger logic.&lt;br&gt;2. Make client side to reload the entity after save was done. (I believe that hotfix for GetSingleAsync issue will be available soon&lt;span style="font-size: 10pt;"&gt;)&lt;br&gt;&lt;/span&gt;&lt;span style="font-size: 10pt;"&gt;3. If you know the estimated time the trigger process will finish, you could wait several second before reload the data.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;About disposing the DbContext and create a new one, may be you could create the new DbContext while leaving the original one then get the required data from the new context.&lt;/p&gt;&lt;p&gt;Best Regards,&lt;br&gt;Leo&lt;/p&gt;</description></item><item><title>How to Use Crosslight in Reloading an Entity and its Navigation Properties from Server-Side?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-in-Reloading-an-Entity-and-its-Navigation-Properties-from-Server-Side/</link><pubDate>Tue, 01 Sep 2015 15:47:50 GMT</pubDate><dc:creator>jtungol@silentpartnersoft.com</dc:creator><description>Any idea on how we might accomplish this on the server side using the Web API? Currently, we are using AfterSaveChangesDelegate to reload or load navigation properties, including the entity that is being updated. However, there are numerous forums that state that context cannot live long and are not meant to live long for that matter. There are suggestions that the original DbContext should be disposed and create another one. While that can be accomplished, we don't see how that is going to work with Crosslight's Enterprise design through the AfterSaveChangesDelegate. Disposing the original context also means that any change tracking behind the scene will stop. The solution provided by Arief in &lt;a href="http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-Enterprise-Framework-to-Update-Calculated-Fields/" target="_blank"&gt;this thread&lt;/a&gt; does work at times in simple scenarios where a trigger is simple enough that the results of an updated row are refected in an instant. However, most of the triggers that we have require complex calculations that updating the expected results of a row or record might be delayed at some point; thus, it might make sense the the navigation properties are updated on the second time an entity is being saved from the client-side. That being said, we can't save the same data twice from the client-side in order to get the updated data for a navigation property. &lt;br&gt;&lt;br&gt;Although triggers should be synchronous in nature, and calling SaveChanges in a DbContext should have triggered the changes of the affected rows. We don;t understand why the reload or load methods of the entity functions are unable to retrieve an update record for the navigation properties attached to the entity that has been saved. Any solutions or workarounds would be very much appreciated. Thanks!&lt;br&gt;</description></item><item><title>How to Use Crosslight in Reloading an Entity and its Navigation Properties from Server-Side?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-in-Reloading-an-Entity-and-its-Navigation-Properties-from-Server-Side/</link><pubDate>Mon, 31 Aug 2015 20:19:22 GMT</pubDate><dc:creator>jtungol@silentpartnersoft.com</dc:creator><description>&lt;p&gt;We've posted a similar question before (&lt;a href="http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-Enterprise-Framework-to-Update-Calculated-Fields/" target="_blank"&gt;click here&lt;/a&gt;), but this approach is unstable. The first time an entity is being saved, the navigation properties should already contain the calculated data based on triggers. We have to send another save request from the client-side in order to get the updated values for the navigation properties. This is terrible, we can;t send multiple requests just to get the updated values. This leads us to refresh data from client-side by using GetSingleAsync() method from the repository, but we're getting errors using commposite keys (&lt;a href="http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-in-Refreshing-an-Entity-from-Client-Side-with-Composite-Keys/" target="_blank"&gt;see here&lt;/a&gt;). Still this seems like multiple round trips from client-side to the server (after saving &amp;gt; refresh data).&lt;/p&gt;&lt;p&gt;Please advise! Thanks!&lt;br&gt;&lt;/p&gt;</description></item></channel></rss>