! 제품 버전을 정확하게 입력해 주세요.
제품 버전이 정확하게 기재되어 있지 않은 경우,
최신 버전을 기준으로 안내 드리므로
더욱 빠르고 명확한 안내를 위해
제품 버전을 정확하게 입력해 주세요!

[EN] .NET Data Connector를 사용하여 온라인 또는 CRM 데이터 소스를 로컬에 캐싱하는 방법 > 블로그 & Tips

본문 바로가기

ComponentOne

블로그 & Tips

[EN] .NET Data Connector를 사용하여 온라인 또는 CRM 데이터 소스를 로컬에 캐싱하는 방법

페이지 정보

작성자 GrapeCity 작성일 2021-11-04 15:55 조회 5,492회 댓글 0건

본문

When working with web services, it is prudent to cache data locally to improve performance. This results in two advantages: network roundtrip is saved when querying the same recordset, and second is if the web service employs some kind of throttling on the number of requests and size of data, then denial of service is avoided. This blog will demonstrate what caching mechanism could get used when getting data from online data sources such as Salesforce CRM using ComponentOne DataConnectors.

ComponentOne DataConnectors are part of DataServices edition. This edition also includes various services such as:

  • DataEngine: Can be used for the fast in-memory analysis of large data

  • CollectionView: Can be used to provide filtering, grouping sorting, and data virtualization capabilities to data-aware controls,

  • CalcEngine: An Excel-like calculation library

  • TextParser: A text parsing library to extract data from text, HTML, CSV, PDF and Doc files.

  • Web API's for:

    • Report generation and export that also integrates with MVC/JavaScript FlexViewer

    • PDF generation, which also integrates with MVC/JavaScript FlexViewer

    • Cloud Storage perform CRUD operation over Azure, AWS, DropBox, OneDrive & GoogleDrive

    • Website visitor tracking

    • Excel API's to generate excel from data or based on the template, merge & split Excel files

    • BarCode API to generate barcode on the fly

Default Cache

DataConnectors have an in-built default caching that uses SQLite. To enable it, we can use a connection string with "Use Cache" and "Cache Location" (optional) keys.

const string GCSalesforceServerConnectionString = @"Username=**********;Password=***********;Security Token=************;
                                              OAuth Client Id=***********;
                                              OAuth Client Secret=***************;
                                              OAuth Token Endpoint=https://ap16.salesforce.com/services/oauth2/token;
                                              Url=https://ap16.salesforce.com/services/data/v45.0";
// Configure connection string with cache settings      
static String connectionString = $@"{GCSalesforceServerConnectionString}; Use Cache = true; Cache Tolerance = 600; Cache Location = 'C:\Windows\Temp\c1cache.db'";
C1SalesforceConnectionStringBuilder builder = new C1SalesforceConnectionStringBuilder();
builder.ConnectionString = connectionString;


SQL Server Cache

Since the 2021 v2 release of DataServices, DataConnectors support caching data to SQL Server. This caching technique additionally uses the Cache Provider and Cache Connection settings to specify the cache settings for SQL Server. The cache provider used is "Microsoft.Data.SqlClient", cache connection can be the connection string to the SQL Server database that is supposed to store cached data. Note that it is a prerequisite to creating the cache database in SQL Server. The connection object cannot create this database. In this example, SalesforceCache database was created beforehand.

string sfconstring = @"username=abc@email.com;password=xxxxx;security token=xxxxxx;" +
              "oauth client id=xxxxxxxx; " +
              "oauth client secret = xxxxx; " +
              "oauth token endpoint = https://login.salesforce.com/services/oauth2/token;url=https://ap16.salesforce.com/services/data/v42.0; " +
              "use pool=True;max page size = 200; api version = 42.0; ; Use Cache = 'true';cache tolerance=60000; cache provider = 'Microsoft.Data.SqlClient'; " +
              "cache connection = 'Server=.\\SQLEXPRESS;Initial Catalog=SalesforceCache;Persist Security Info=false; " +
              "Integrated Security=true;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=True;Connection Timeout=30'";
​
C1.AdoNet.Salesforce.C1SalesforceConnection con = new C1.AdoNet.Salesforce.C1SalesforceConnection();
con.ConnectionString = sfconstring;
​
C1.AdoNet.Salesforce.C1SalesforceDataAdapter da = new C1.AdoNet.Salesforce.C1SalesforceDataAdapter(con, "select * from Account");
DataTable dt = new DataTable();
da.Fill(dt);


image


Incremental Cache

In applications dealing with a large amount of data, historical data may seldom change. On the other hand, new data may get added, or recent data could be updated. But the application may still need all this data for comprehensive analysis. Such an application can benefit by using the Incremental Cache feature of the data connector. Any table that needs incremental updates to cache must have a timestamp column that notes when the record was updated\added. This column helps the data connector determine if the record needs to be updated to the cache database. Fortunately, most internet-based data sources support this kind of column in the tables. To enable this feature on data connectors, set the IncrementalUpdate to true and the name of the timestamp column to IncrementalUpdateColumn. For a list of timestamp column names, please refer to the documentation.


Caching in FlexReport Designer Application

image


FlexReport designer has an inbuilt feature to connect to various cloud data sources using data connectors. It too supports caching with the data connectors to enhance performance. The cache settings can be configured using the property grid that opens when clicking on the ellipses button next to the connection string textbox on the DataSources window. However, it does need that cache database folder already exist, meaning, if we set the path of Cache Location to "C:\MyAppCache\FRtest.db", then there should be a folder named MyAppCache already present so that cache database could be created by data connector if using SQLite as cache database.


Caching when Using Visual Studio Server Explorer

DatConnectors could be used in Visual Studio Server Explorer to connect to cloud data sources without writing a single line of code. Using Server Explorer features, queries could be built either using SQL or query builder. However, setting caching through connection dialog is not supported. The cache settings can be done in applications using code or configuration.


Tips & Tricks

When working with a cache database, you may require to troubleshoot or remove cache db for data corruption or any reason. You should also delete the CacheMetaData file below location before creating a new cache database.

C:\Users\(UserName)\AppData\Roaming\C1DataConnector




지금 바로 ComponentOne을 다운로드하여 직접 테스트해보세요!

 
  • 페이스북으로 공유
  • 트위터로  공유
  • 링크 복사
  • 카카오톡으로 보내기

댓글목록

등록된 댓글이 없습니다.

메시어스 홈페이지를 통해 제품에 대해서 더 자세히 알아 보세요!
홈페이지 바로가기

태그1

메시어스 홈페이지를 통해 제품에 대해서 더 자세히 알아 보세요!
홈페이지 바로가기
이메일 : sales-kor@mescius.com | 전화 : 1670-0583 | 경기도 과천시 과천대로 7길 33, 디테크타워 B동 1107호 메시어스(주) 대표자 : 허경명 | 사업자등록번호 : 123-84-00981 | 통신판매업신고번호 : 2013-경기안양-00331 ⓒ 2024 MESCIUS inc. All rights reserved.