473,763 Members | 6,401 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 16948
You could use the Enterprise Library Caching module. Or, for a simple cache,
use the AppDomain cache:

AppDomain.Curre ntDomain.SetDat a("key", value);
DataSet ds = (DataSet)AppDom ain.CurrentDoma in.GetData("key name");

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...@yaho o.yabbadabbadoo .comwrote:
You could use the Enterprise Library Caching module. Or, for a simple cache,
use the AppDomain cache:

AppDomain.Curre ntDomain.SetDat a("key", value);
DataSet ds = (DataSet)AppDom ain.CurrentDoma in.GetData("key name");

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.Curre ntDomain.SetDat a("key", value);
DataSet ds = (DataSet)AppDom ain.CurrentDoma in.GetData("key name");
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.Curre ntDomain.SetDat a("key", value);
DataSet ds = (DataSet)AppDom ain.CurrentDoma in.GetData("key name");

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
1737
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 several asmx webservices pages used for inter-server communications, e.g. invalidate the cached items, status notifications. Since these asmx pages need to access the same application domain and httpcontext as primary asp.net application, the files...
2
1814
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 included? Do they coexist? 2. Is Singleton the kind of default storage method relating to application wide memory - Is it different in web vs Win apps? 3. Should we just use the ASPNET cache for web apps and the CAB for Win
1
1925
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 making a call to the webservice, as and when the time expires? I believe on the server side this is done using System.Web.Caching where you have a number of dependencies to set. Is there something similar available for the client side? If not does...
1
8559
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 Me.ReportViewer1.ServerReport.ReportPath = "/myproject/DemandeDeCotation" Me.ReportViewer1.ServerReport.ReportServerUrl = New System.Uri("http://myserver/reportserver2005", System.UriKind.Absolute)
4
3939
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 someone who is not on my team. The VB 6.0 application is used by approximately 100 users. All users reside in-house. There is an existing external website that will use some of the same components but the two applications are separate. The...
3
1502
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 system.web.security in Windows Application for this purpose ? Best Regards, Luqman
3
472
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 GetWebPageTicket(string CurrentObject) { Guid CacheID = Guid.NewGuid(); Methods.ErrLog(CacheID.ToString(), false, false);
4
1623
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 to control caching dynamically according to my configuration. Thanks,
23
4554
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 memorize and/ or familiarize myself in WinForms will disappear in WPF? I did note in one early version of C#, the non-generic "ArrayList" was replaced by the generic and template <based List, but that kind of change is not a big deal. If WPF...
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9997
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9822
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7366
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.