Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →Faster Reporting using the CData Provider for Salesforce
The CData ADO.NET Provider for Salesforce exposes caching features that can be used to avoid the delay of executing commands over the network, to create applications with offline functionality, to use a particular SQL dialect, and more. Caching can be transparent to the application. This article shows how to enable the Auto Cache feature to meet one of the common use cases for caching: to provide fast reporting from the cache, even when working with large data sets.
Creating the Cache
You can reduce network load times by querying a local cache. The Auto Cache feature enables you execute expensive queries against a local cache, while also ensuring that reporting is from the current data. When Auto Cache is enabled, all queries are executed against the data source and, additionally, SELECT queries will create and update the cache. You can explicitly query the cache with the syntax below:
SELECT * FROM Account#CACHE
To enable the Auto Cache feature, set the Auto Cache connection string property to True and open a connection. To create the cache and store a table, execute a SELECT query. The code example below shows how to connect and create the cache.
string connectionString = "User=test;Password=test;AccessToken=x12345";
"Auto Cache=true;";
using(SalesforceConnection conn = new SalesforceConnection(connectionString)){
SalesforceDataAdapter dataAdapter = new SalesforceDataAdapter("Select * From Account", conn);
DataTable table = new DataTable();
dataAdapter.Fill(table);
}
Implementation of a Caching Strategy
You can download the sample application to see how to create a complete application using the code examples in this article. The included sample project integrates the basic components of an effective caching solution with a simple application that displays the current Salesforce data.