Wednesday 14 September 2011

RemoteOfflineRuntime; Context to request a cache refresh in a BCS

RemoteOfflineRuntime represents the entry point for handling business data offline. In few words it handles data offline, cache!

It is hard to find documentation about so I am going to do a step by step to create the following case: We will   programmatically do a cache refresh from a client application. When run, this code starts the BCSSync service if it is not already running and requests a refresh in the BDC client cache.

1- Go to Visual Studio 2010->New Project-> C#->Console Application and call it netsourcecodeCacheRefresh.

image

2- Go to references and add the following ones:

  • Microsoft.BusinessData.dll
  • Microsoft.Office.BusinessApplications.Runtime.dll
  • Microsoft.Office.BusinessData.dll

if you can’t find them just check in this folder:C:\Program Files\Microsoft Office\Office14

3- Go to Program.cs remove everything in there and add this code (don’t forget to change the parameters, see below):

  • entityNamespace: Type: System.String The namespace of the subscription external content type.
  • entityName: Type: System.String The name of the subscription external content type.
  • viewName: Type: System.String The namespace of the subscription View.
  • subscriptionName: Type: System.String The subscription programmatic name.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.BusinessData.Offlining;
using Microsoft.Office.BusinessData.Offlining;
namespace netsourcecodeCacheRefresh
{
    class Program
    {
        static void Main(string[] args)
        {
            RemoteOfflineRuntime offlineRuntime = new RemoteOfflineRuntime();
            ISubscriptionManager subManager = offlineRuntime.GetSubscriptionManager();
            ISubscription sub = subManager.GetSubscription("<EntityNameSpace>", "<EntityName>", "<ViewName>", "<SubscriptionName>");
            sub.RequestRefresh(true);
        }
    }
}


Enjoy!


To download the project, click in the icon.


image

2 comments:

Anonymous said...

Yes! Finally something about g spot porn.

Visit my webpage ... www.sexyhotgirlz.com

Anonymous said...

wonderful publish, very informative. I wonder why the opposite
experts of this sector don't notice this. You should proceed your writing. I am confident, you have a huge readers' base already!


My blog - naked massage