title: Mid-tier caching for Windows Forms Application
body: <p>I have a simple Windows Forms Application which is written C# 4.0. The application shows some of the records from database. The application features a query option which is initiated by user. </p>
  
  <p>The records in the database we can call as jobs
  Consider the two columns JobID and Status</p>
  
  <p>These being updated by two of the background services which in fact work like a producer consumer services. The status of the job will be updated by these services running behind.</p>
  
  <p>Now for the user, who has an option to query the records from the database, say for e.g. to query data based on status (Submitted, processing, completed). This can result in thousands of records and the GUI might face some performance glitches on displaying these much of data.</p>
  
  <p>Hence, it's important to display chunks of the query results as pages. The GUI isn't refreshed until user manually refresh or make the new query. </p>
  
  <p>Say for e.g. Since the jobs are being constantly updated from the services, the job status can be different at any point of time. The basic requirement that the pages should have the data at the time those were fetched from the DB.</p>
  
  <p>I am using LINQ to SQL for fetching data from the DB. It's quite easy to use but there isn't something mid-level caching required to meet this demand. Using the process memory to cache the results can shoot up page memory to the extreme if the number of records are very high. Unfortunately LINQ isn't providing any mid-tier caching facilities with the DataContext objects.</p>
  
  <p>What are the preferable way to implement a paging mechanism with C# 4.0 + SQL Server + Windows environment?</p>
  
  <p>Some of the alternatives I feel like to have a duplicated table/DB which can temporarily store the results as cache. Or using Enterprising Application Library's Application Cache Block. I believe that this is a typical problem faced by most of the developers. Which is the most efficient way to solve this problem. (NOTE: my application and DB running on same box)</p>