473,408 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

How to implement cache in WinForms application

I'm creating C# WinForms client-server database application.

This application reads data from PostgreSQL server using npgsql Dataadapter
and DataReader classes and stores data mostly in Datasets and sometimes in
business object properties.

A lot of lookup tables (payment terms, currency list etc) are static.
Currently application reads them from server when new window is opened over
TCP connection
This makes application slow.

How to cache data in client side ?

Where to find caching module for .NET application ?

It it reasonable to use .NET 2 Web Cache object for this ?
MS Web Cache object doc says that it is designed only for ASP .NET
application.
Is it reasonable to use it in WinForms application or are there better
caching object available?

I cannot use MS Caching application block since my application needs to run
in
Linux also.

Andrus.

Jun 11 '07 #1
8 16875
You could use the Enterprise Library Caching module. Or, for a simple cache,
use the AppDomain cache:

AppDomain.CurrentDomain.SetData("key", value);
DataSet ds = (DataSet)AppDomain.CurrentDomain.GetData("keyname" );

Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Andrus" wrote:
I'm creating C# WinForms client-server database application.

This application reads data from PostgreSQL server using npgsql Dataadapter
and DataReader classes and stores data mostly in Datasets and sometimes in
business object properties.

A lot of lookup tables (payment terms, currency list etc) are static.
Currently application reads them from server when new window is opened over
TCP connection
This makes application slow.

How to cache data in client side ?

Where to find caching module for .NET application ?

It it reasonable to use .NET 2 Web Cache object for this ?
MS Web Cache object doc says that it is designed only for ASP .NET
application.
Is it reasonable to use it in WinForms application or are there better
caching object available?

I cannot use MS Caching application block since my application needs to run
in
Linux also.

Andrus.

Jun 11 '07 #2
On Jun 11, 4:47 pm, Peter Bromberg [C# MVP]
<pbromb...@yahoo.yabbadabbadoo.comwrote:
You could use the Enterprise Library Caching module. Or, for a simple cache,
use the AppDomain cache:

AppDomain.CurrentDomain.SetData("key", value);
DataSet ds = (DataSet)AppDomain.CurrentDomain.GetData("keyname" );

Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net

"Andrus" wrote:
I'm creating C# WinForms client-server database application.
This application reads data from PostgreSQL server using npgsql Dataadapter
and DataReader classes and stores data mostly in Datasets and sometimes in
business object properties.
A lot of lookup tables (payment terms, currency list etc) are static.
Currently application reads them from server when new window is opened over
TCP connection
This makes application slow.
How to cache data in client side ?
Where to find caching module for .NET application ?
It it reasonable to use .NET 2 Web Cache object for this ?
MS Web Cache object doc says that it is designed only for ASP .NET
application.
Is it reasonable to use it in WinForms application or are there better
caching object available?
I cannot use MS Caching application block since my application needs to run
in
Linux also.
Andrus.- Hide quoted text -

- Show quoted text -
Where exactly it would be stored, I mean inside app domain, does it
maintain a section for SetData() data?

Jun 11 '07 #3
You could use the Enterprise Library Caching module. Or, for a simple
cache,
use the AppDomain cache:

AppDomain.CurrentDomain.SetData("key", value);
DataSet ds = (DataSet)AppDomain.CurrentDomain.GetData("keyname" );
Peter,

thank you.

I looked into MSDN but doc about those methods is terse.

Will the dataset persist if I exit and re-run my application ?
Are they stored in isolated storage ?

How I can invalidate objects in cache? I think I need to implement command
like "Refresh" which causes to re-load all data.

Andrus.

Jun 11 '07 #4
Where exactly it would be stored, I mean inside app domain, does it
maintain a section for SetData() data?
I think datasets should be stored in memory and maybe in isolated storage
also.

I did'nt understand your question about SetData() section.

I need also some method to clear the cache (invalidate all stored data).

Andrus.

Jun 11 '07 #5
On Jun 11, 9:25 pm, "Andrus" <kobrule...@hot.eewrote:
Where exactly it would be stored, I mean inside app domain, does it
maintain a section for SetData() data?

I think datasets should be stored in memory and maybe in isolated storage
also.

I did'nt understand your question about SetData() section.

I need also some method to clear the cache (invalidate all stored data).

Andrus.
I was asking abou the storage - if we use the SetData() method, where
would the data be placed. A hashtable in the app domain space?

Jun 11 '07 #6
No, because when you quit your app you're tearing down the AppDomain it was
loaded into. However, the idea of a cache is that when your app starts, you
get the data one time and cache it, so that should not be a problem.
If you want cache invalidation and all the "fancy stuff", take a look at the
latest (3.1) version of the Enterprise Library.
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Andrus" wrote:
You could use the Enterprise Library Caching module. Or, for a simple
cache,
use the AppDomain cache:

AppDomain.CurrentDomain.SetData("key", value);
DataSet ds = (DataSet)AppDomain.CurrentDomain.GetData("keyname" );

Peter,

thank you.

I looked into MSDN but doc about those methods is terse.

Will the dataset persist if I exit and re-run my application ?
Are they stored in isolated storage ?

How I can invalidate objects in cache? I think I need to implement command
like "Refresh" which causes to re-load all data.

Andrus.

Jun 11 '07 #7
On Jun 11, 9:25 pm, "Andrus" <kobrule...@hot.eewrote:
Where exactly it would be stored, I mean inside app domain, does it
maintain a section for SetData() data?

I think datasets should be stored in memory and maybe in isolated storage
also.

I did'nt understand your question about SetData() section.

I need also some method to clear the cache (invalidate all stored data).

Andrus.

I was asking abou the storage - if we use the SetData() method, where
would the data be placed. A hashtable in the app domain space?
As I understand from Peter and your replies, SetData() simply holds objects
in memory hash table.

I have no idea why SetData() and GetData() methods are present
in AppDomain class at all: it should be trivial to create hash table in
application for this.

Andrus.

Jun 11 '07 #8
No, because when you quit your app you're tearing down the AppDomain it
was
loaded into. However, the idea of a cache is that when your app starts,
you
get the data one time and cache it, so that should not be a problem.
Why SetData() and GetData() methods exist in AppDomain ?
It should be trivial to create hash table which holds object type of object
and use it insted using those methods !?

Why those methods exist in .NET ?
If you want cache invalidation and all the "fancy stuff", take a look at
the
latest (3.1) version of the Enterprise Library.
Enterprise Library license prohibits its usage in non-Windows environment.

If I need that my application can run in Linux with MONO , how I can use
Enterprise Library ?

Andrus.

Jun 11 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Invalidlastname | last post by:
Hi, Here is the issue: we have an ASP.NET application which is protected by Form authentication. The web application is hosted in the web-farm environment on multiple web servers. There are...
2
by: Harry Simpson | last post by:
If anyone can chime in on these questions, I'd sure appreciate it. 1. How does the cache block fit in with the UIP Block - Is the "state" managed there handled any differently with the CAB...
1
by: Vinit | last post by:
Hello I have a C# application and am caching some data on the client side by using a HashTable. Is there a way I can set Cache dependencies like a time factor by which my cache is updated by...
1
by: Pieter | last post by:
Hi, In my application VB.NET 2005 application I placed a ReportViewer, and link it to a server-report: Me.ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote...
4
by: 3Cooks | last post by:
I have a windows application written in Visual Basic 6.0 that is going to be redeveloped in dotNET. We are trying to decide if we should deploy using Webforms or Winforms and I need advice from...
3
by: Luqman | last post by:
How to implement Role Enabled Security in Visual Basic 2005 Windows Application, like we do in ASP.Net 2.0 ? I want to use Sql Server Membership Security for Adding Roles and Users. Can I use...
3
by: moondaddy | last post by:
This code is all executed on my dev machine running winXP sp2 and VS2005. I have a winforms 2.0 app that calls a web service wich caches a GUID for a short time like this: public string...
4
by: Girish | last post by:
i have to implement caching in my application, can any one tell me about the good techniques to implement caching, or provide some architectural help , so i can use it to my application. i want...
23
by: raylopez99 | last post by:
Here I am learning WinForms and two months into it I learn there's a WPF API that is coming out. Is this WPF out yet, and is it a threat to WinForms, in the sense that all the library routines I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.