JRockFL
asked on
Winforms - Caching Data
I have a winforms application and would like to cache the look up tables when the application loads.
I would like to have a collection of table names and then when the application loads, iterate through the collection
and then cache each table.
Any suggestions to get me started?
I would like to have a collection of table names and then when the application loads, iterate through the collection
and then cache each table.
Any suggestions to get me started?
Subscribe
You can declare some DataTable objects at the module level. In the form load of the main form, load these tables. Then you can use these tables across the whole application. Any variable/function in module has an application level scope.
ASKER
CodeCruiser,
Thank you for your reply. I actual use entities objects for data and another class that inherits from collectionbase class.
Public Class StatesCollection
Inherits CollectionBase
End Class
Without making this a shared class, what do you suggestion for caching?
I wanted to have a table that just stored the table name, then I could iterate through all of the tables.
Public Class TableCache
End Class
Public TableCacheCollection
Inherits CollectionBase
End Class
For each tc As TableCache in TableCacheColletion
'cache the some objects
'what do you suggest?
Next
Thank you for your reply. I actual use entities objects for data and another class that inherits from collectionbase class.
Public Class StatesCollection
Inherits CollectionBase
End Class
Without making this a shared class, what do you suggestion for caching?
I wanted to have a table that just stored the table name, then I could iterate through all of the tables.
Public Class TableCache
End Class
Public TableCacheCollection
Inherits CollectionBase
End Class
For each tc As TableCache in TableCacheColletion
'cache the some objects
'what do you suggest?
Next
I am not sure why you want to store the table names in the collection and have the caching enabled by this. You need to store the table contents somewhere as well. If you dont know the table names and how do you use them in code?
ASKER
I wanted to store the names of the tables that I want to cache.
So I would have table in Sql Server called TableCache.
In this table, I would then list all of the names of the tables that I would want to cache.
For example, States.
Then When the application loaded, I could query the tablecache table and determine all of the tables that would be cached.
Does that make sense?
So I would have table in Sql Server called TableCache.
In this table, I would then list all of the names of the tables that I would want to cache.
For example, States.
Then When the application loaded, I could query the tablecache table and determine all of the tables that would be cached.
Does that make sense?
Yes. But that is not much complicated is it? Do you need to code for writing to and reading from this table?
ASKER
Ok let's not worry about that then.
What do you recommend for caching objects like this then?
Public Class StatesCollection
Inherits CollectionBase
End Class
What do you recommend for caching objects like this then?
Public Class StatesCollection
Inherits CollectionBase
End Class
I would use variables in a module to store these objects.
ASKER
Ok, can you provide me a quick code sample?
I'm not familiar with a module
I'm not familiar with a module
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Bellow url give some information'
http://www.codeproject.com/KB/database/WinFormGridviewCaching.aspx
http://www.vbdotnetheaven.com/UploadFile/nikhil_be_it/CachingDatainWinFormsDataGridView05092006023536AM/CachingDatainWinFormsDataGridView.aspx