What Is a Cache Subscription?

Applies to: SharePoint Server 2010

In this article
Query
Explicit Identities
Subscription Association

A subscription defines what gets populated in the cache and is automatically generated by the Business Connectivity Services (BCS) during deployment of a BCS solution. It is represented as an XML file (subscription.xml) and can be found in the deployment folder. Although a subscription is auto-generated at deployment-time, you can modify a subscription programmatically using the object model. Editing the XML file will have no effect. Subscriptions cannot be deleted.

A subscription contains:

  • Queries: The queries (Finders) that must be executed to get the required entity instances into the cache.

  • Explicit Identities: Any additional entity instances that you want to bring from the external data source by providing their identities explicitly.

  • Associations: Any related entity instances you are interested in from the external data source.

In our simple Customers solution example, when the Customers external list is connected to Outlook, a subscription.xml gets created as part of the deployment process. Let’s see what this subscription contains in the next few topics.

Query

Subscriptions usually contain one or more queries. A query is a Finder method instance defined in the model that must be executed to get the required entity instances into the cache. A query can take filter values. Therefore, you can have multiple queries in your subscription all which use the same Finder method instance but use different filter values. For example, in our Customers solution, there will be three queries:

  • Query 1: GetCustomers,filter value = CA, returns customers from California

  • Query 2: GetCustomers,filter value = WA, returns customers from Washington

  • Query 3: GetCustomers,filter value = NJ, returns customers from New Jersey

Explicit Identities

A cache subscription can contain explicit identities. Identity represents the unique identifier of an entity instance that you want in addition to any entity instances returned by any queries. So in our Customers example, we could edit the subscription (by editing the subscription.xml file or by using the object model) to add a few explicit identities if for example, we wanted to see Customer #123 and Customer #157 from Oregon in addition to the customers from California, Washington, and New Jersey.

Subscription Association

Subscriptions can also contain one or more subscription associations. A subscription association is an AssociationNavigator method instance defined in the model that can be executed to get related entity instances into the cache.

Note

You should only add subscription associations if you need them as they are a lot of overhead in the cache and may affect the performance of the application severely. This is explained in more detail in later sections.