NetSuite Data Provider - Online Help
NetSuite Data Provider
Questions / Feedback?

Caching Metadata

For each query you wish to perform, the provider must rely on the metadata or schemas that describe the tables queried. If the metadata is not present, the provider establishes a separate connection with the live data source to retrieve the metadata before querying the data. This process can be slow and expensive, especially if multiple tables need to be queried.

The solution is to cache table metadata. Instead of retrieving the metadata fresh for each table per each query, caching the metadata locally stores the metadata that describes the table. Thus, the metadata from the live data source need be fetched only once.

Enable Caching Metadata

To enable this feature, simply set the CacheLocation and CacheMetadata in your connection string, and the RSSBus ADO.NET Provider for NetSuite handles the rest automatically. The provider will cache the metadata the first time it is needed and use it onwards.

Update the Metadata Cache

Altering the schema on the live data source - for example, in the event a column is added or dropped - is not reflected automatically in the local metadata cache. Delete the cache file if you expect your data definitions to have changed. By default, the metadata cache is located in %AppData%\RSSBus.

Cache Metadata from Code

The following code can be used to build the metadata cache. This is especially useful in using the data provider in Entity Framework.

C#

String connectionString = "Cache Location=C:\\cache.db;Cache MetaData=True;Account Id=XABC123456;Password=password;User=user;Role Id=3;Version=2013_1;Location=C:\\myfolder\\;";
using (NetSuiteConnection conn = new NetSuiteConnection(connectionString)) {
  conn.Open();
  DataTable table = conn.GetSchema("Tables");
  Console.WriteLine("Total number of tables found: " + table.Rows.Count);

  foreach (DataRow row in databaseSchema.Rows) {
    foreach (DataColumn column in databaseSchema.Columns) {
      Console.WriteLine(row[column]);
    }
  }
  Console.WriteLine();
  Console.WriteLine("All tables cached.");
}

VB.NET

Dim connectionString As String = "Cache Location=C:\\cache.db;Cache MetaData=True;Account Id=XABC123456;Password=password;User=user;Role Id=3;Version=2013_1;Location=C:\\myfolder\\;"
Using conn As New NetSuiteConnection(connectionString)
  conn.Open()
  Dim databaseSchema As DataTable = conn.GetSchema("Tables")
  Console.WriteLine("Total number of tables found: " + databaseSchema.Rows.Count.ToString())

  For Each row As DataRow In databaseSchema.Rows
    For Each column As DataColumn In databaseSchema.Columns
      Console.WriteLine(row(column))
    Next
  Next
  Console.WriteLine()
  Console.WriteLine("All tables cached.")
  Console.ReadKey()
End Using

 
 
Copyright (c) 2015 RSSBus, Inc. - All rights reserved.
Build 1.0.5578.0