0

Here's an ASP.NET data source/grid in a sample application (the WebAppWalkthrough application provided with the SDK)

<crm:SavedQueryDataSource ID="EligiblePatients" SavedQueryName="Patients View" runat="server"  />
<asp:GridView id="EligiblePatientsGrid" DataSourceID="EligiblePatients" runat="server" />

So this pulls contacts from the saved query called Patients View in our CRM instance.

I installed the Xrm Portal plugins and created a Web Notification URL as shown in this procedure, to trigger an invalidation of the cache when entities in CRM are created/deleted/updated, but no go.

For the updates to come through, I need to shutdown the webdev process that's used to run applications in Visual Studio and then the changes are visible.

It is real weird though. If I start debugging my application (assuming the local application pool is starting for the first time) I do see the live data from CRM. Then if I changed something in CRM and refresh my webpage, I do see the changes.

It's when I do the same test a 2nd, 3rd, 4th, etc. time, then the changes are never shown on the webpage, no matter what happens in CRM, that is unless I kill the application pool.

Any ideas ?

Francis Ducharme
  • 4,848
  • 6
  • 43
  • 81

2 Answers2

0

Recreate the context on each page load. Processor time is cheaper than memory (session storage) and it will be a whole lot easier to work with, especially if you are going to reload updates from the context anyway. If you have performance problems later, then look at caching (and all the hassle that entails).

Josh Painter
  • 4,071
  • 21
  • 26
  • Actually, I just realized my data source is not using this `xrm` object at all so recreating it is not changing much. It's the `SavedQueryDataSource` data source that needs to be told to refresh everytime. I edited my question accordingly. – Francis Ducharme May 05 '14 at 15:15
  • I fundamentally disagree with this assertion. Memory is cheap and database access is expensive. You should do your best to only reload information from the database that needs to be refreshed. – Zach Mast May 05 '14 at 16:47
  • @Zach The question has changed quite a bit since, thanks both for your input though. – Francis Ducharme May 05 '14 at 18:47
0

This did the trick:

How to disable CRM 2011 Xrm caching?

I can't see if the procedure I mentioned above is also part of the reasons why it works now though.

Community
  • 1
  • 1
Francis Ducharme
  • 4,848
  • 6
  • 43
  • 81