Global datasets

D

Dan Bass

The way I thought of caching is the generally known way, such as page
caching, sticking items in session or application variables or into the
viewstate. None of these really appealed to me for the purpose of this.
Apologies if this has caused a wasted journey to the solution.

No need to apologise... we're all learning. I don't know a quarter of what I
should..

So, one more question, with what I have here in this code, if I make the
"Folders" static, and I make a change to the database, I need to somehow
update the static folders. How can I trigger the update?

Ah, this is the question... Really. They should be initalised once (when IIS
starts?) and then left as readonly.
http://samples.gotdotnet.com/quickstart/aspplus/doc/stateoverview.aspx

If you're bothered about the refreshing bit, then perhaps have it done in a
session state rather than application. Then you can access it through your
page where ever you need to. Each time the user goes to the web site and in
turn creates a new session, the object will be refreshed.
 
G

Guest

What I am thinking is that I can make the folders have application level
scope. The folders are defined from the database. An admin can create a new
folder at any time, but that then needs to be reflected in the folder
structure, especially so that the admin can then work with that folder if
nothing else...

I am thinking that in the singleton, I could create another function that
refreshes the datatable, but I don't know how this would be written and how
to call it (I would want to do something like .refresh (I don't mind if only
admin pages can see it, or future programmers in the page...))

At the moment, I have created the datatable as static like the mObj.


Regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Portal franchises available
 
D

Dan Bass

You could do that. Refresh would be a public method that simply recreates
the object by calling new on mObj (from your example I think).
Admins could then have a Refresh button, that when clicked, called this
refresh method.

It's a shame because it's manual. The other way of course would be to
restart IIS. :-o
 
G

Guest

I have just implemented it... Had a few probs, but got it to work.

My constructor now calls a private function to load the data into the
datatable.

I have a RefreshFolders function which now also calls this new datatable
loading function. So, my DataTable can be done by hand.

It isn't a problem for my application to "manually" do it. Folders will only
be created once in a while and ONLY through a web interface. This means that
at the point of creating the folder (an admin process), I can refresh the
data at exactly the same time. I think this is probably the best solution,
much better than what I was originally trying to achieve.

Something else I was having a problem with, which I have also resolved...

the class is an IEnumerable so that I can navigate throught he folder
structure usign foreach. What I didn't want was for the user of the app
having to run the ienumerable Reset() every time they wanted to use the data.

As part of the class, I have:
public System.Collections.IEnumerator GetEnumerator()
{
// Polymorph this object into an IEnumerator interface
return (System.Collections.IEnumerator)this;
}

I don't know what the above is doing, but, I can stick a call to Reset() in
here and that will move the pointer to the start of the data, so I don't have
to rely on the programmer putting in a reset.

Cool.

Still a long way to go, but I am happy that this so far, appears to be
resolved. Thank you for your help.

Regards,
Dave Colliver.
http://www.MatlockFOCUS.com
~~
http://www.FOCUSPortals.com - Portal franchises available
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,199
Latest member
AnyaFlynn6

Latest Threads

Top