473,778 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application Ending : Save the static object in a File to reload it alter !

I'm using ASP.NET and quite a lot of object in memory instead of a database.

The question is that I tried to save the data, serialize them in a XML file
to save them when the application is ending.

event : Application_End in Global.asax.

But the object are not accesible from there so I can't save them.

Any idea ???

Thanks.

Nov 18 '05 #1
7 1271
Where do you keep references to the data? In Session?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sat, 27 Nov 2004 09:18:25 +0100, "Shanli RICHEZ" <sh****@noos.fr >
wrote:
I'm using ASP.NET and quite a lot of object in memory instead of a database.

The question is that I tried to save the data, serialize them in a XML file
to save them when the application is ending.

event : Application_End in Global.asax.

But the object are not accesible from there so I can't save them.

Any idea ???

Thanks.


Nov 18 '05 #2
No in static hashTable or ArrayList declare in the classes !

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:r7******** *************** *********@4ax.c om...
Where do you keep references to the data? In Session?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sat, 27 Nov 2004 09:18:25 +0100, "Shanli RICHEZ" <sh****@noos.fr >
wrote:
I'm using ASP.NET and quite a lot of object in memory instead of a database.
The question is that I tried to save the data, serialize them in a XML fileto save them when the application is ending.

event : Application_End in Global.asax.

But the object are not accesible from there so I can't save them.

Any idea ???

Thanks.

Nov 18 '05 #3
Why dont you save the information to the database on first created and when
it changes (ie. pro-actively) rather than trying to save it when the
application ends. That way, the database always contains a reflection of
what is held in memory and reloading it from where you left off is trivial

--
- Paul Glavich
Microsoft MVP - ASP.NET
"Shanli RICHEZ" <sh****@noos.fr > wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
I'm using ASP.NET and quite a lot of object in memory instead of a database.
The question is that I tried to save the data, serialize them in a XML file to save them when the application is ending.

event : Application_End in Global.asax.

But the object are not accesible from there so I can't save them.

Any idea ???

Thanks.

Nov 18 '05 #4
The static object contains counter, statistique per user that can be
increment/decrement 15,000 times an hour.

That's why I do not save them in the database because it will take to much
ressource.

I could save them every minute with a timer, but the problem is that when I
shut down the machine I lose the lastest information. So I wanted to catch
the event n application end to save them.

Shanli




"Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
message news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Why dont you save the information to the database on first created and when it changes (ie. pro-actively) rather than trying to save it when the
application ends. That way, the database always contains a reflection of
what is held in memory and reloading it from where you left off is trivial

--
- Paul Glavich
Microsoft MVP - ASP.NET
"Shanli RICHEZ" <sh****@noos.fr > wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
I'm using ASP.NET and quite a lot of object in memory instead of a

database.

The question is that I tried to save the data, serialize them in a XML

file
to save them when the application is ending.

event : Application_End in Global.asax.

But the object are not accesible from there so I can't save them.

Any idea ???

Thanks.


Nov 18 '05 #5
Then what about the finaliser for the object? It will only be garbage
collected when the apDomain is being unloaded and it keeps that logic within
the object itself.

--
- Paul Glavich
Microsoft MVP - ASP.NET
"Shanli RICHEZ" <sh****@noos.fr > wrote in message
news:OU******** ******@TK2MSFTN GP14.phx.gbl...
The static object contains counter, statistique per user that can be
increment/decrement 15,000 times an hour.

That's why I do not save them in the database because it will take to much
ressource.

I could save them every minute with a timer, but the problem is that when I shut down the machine I lose the lastest information. So I wanted to catch
the event n application end to save them.

Shanli




"Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
message news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Why dont you save the information to the database on first created and

when
it changes (ie. pro-actively) rather than trying to save it when the
application ends. That way, the database always contains a reflection of
what is held in memory and reloading it from where you left off is trivial
--
- Paul Glavich
Microsoft MVP - ASP.NET
"Shanli RICHEZ" <sh****@noos.fr > wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
I'm using ASP.NET and quite a lot of object in memory instead of a

database.

The question is that I tried to save the data, serialize them in a XML

file
to save them when the application is ending.

event : Application_End in Global.asax.

But the object are not accesible from there so I can't save them.

Any idea ???

Thanks.



Nov 18 '05 #6
That's seems to be a good idea.

Thanks.
"Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
message news:%2******** **********@TK2M SFTNGP09.phx.gb l...
Then what about the finaliser for the object? It will only be garbage
collected when the apDomain is being unloaded and it keeps that logic within the object itself.

--
- Paul Glavich
Microsoft MVP - ASP.NET
"Shanli RICHEZ" <sh****@noos.fr > wrote in message
news:OU******** ******@TK2MSFTN GP14.phx.gbl...
The static object contains counter, statistique per user that can be
increment/decrement 15,000 times an hour.

That's why I do not save them in the database because it will take to much
ressource.

I could save them every minute with a timer, but the problem is that when
I
shut down the machine I lose the lastest information. So I wanted to

catch the event n application end to save them.

Shanli




"Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
message news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Why dont you save the information to the database on first created and

when
it changes (ie. pro-actively) rather than trying to save it when the
application ends. That way, the database always contains a reflection of what is held in memory and reloading it from where you left off is

trivial
--
- Paul Glavich
Microsoft MVP - ASP.NET
"Shanli RICHEZ" <sh****@noos.fr > wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
> I'm using ASP.NET and quite a lot of object in memory instead of a
database.
>
> The question is that I tried to save the data, serialize them in a XML file
> to save them when the application is ending.
>
> event : Application_End in Global.asax.
>
> But the object are not accesible from there so I can't save them.
>
> Any idea ???
>
> Thanks.
>
>
>



Nov 18 '05 #7
What happens in Application_End that prevents the save from working?

I'd shy away from the finalizer because there is no guarantee the
finalizer will run. There is one thread dedicated to running
finalizers and the runtime can timeout an operation on the thread to
prevent the thread from hanging.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sun, 28 Nov 2004 12:19:07 +0100, "Shanli RICHEZ" <sh****@noos.fr >
wrote:
That's seems to be a good idea.

Thanks.
"Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
message news:%2******** **********@TK2M SFTNGP09.phx.gb l...
Then what about the finaliser for the object? It will only be garbage
collected when the apDomain is being unloaded and it keeps that logic

within
the object itself.

--
- Paul Glavich
Microsoft MVP - ASP.NET
"Shanli RICHEZ" <sh****@noos.fr > wrote in message
news:OU******** ******@TK2MSFTN GP14.phx.gbl...
> The static object contains counter, statistique per user that can be
> increment/decrement 15,000 times an hour.
>
> That's why I do not save them in the database because it will take tomuch > ressource.
>
> I could save them every minute with a timer, but the problem is thatwhen
I
> shut down the machine I lose the lastest information. So I wanted to

catch > the event n application end to save them.
>
> Shanli
>
>
>
>
>
>
>
>
>
>
> "Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
> message news:%2******** ********@tk2msf tngp13.phx.gbl. ..
> > Why dont you save the information to the database on first created and
> when
> > it changes (ie. pro-actively) rather than trying to save it when the
> > application ends. That way, the database always contains a reflectionof > > what is held in memory and reloading it from where you left off is

trivial
> >
> > --
> > - Paul Glavich
> > Microsoft MVP - ASP.NET
> >
> >
> > "Shanli RICHEZ" <sh****@noos.fr > wrote in message
> > news:%2******** **********@TK2M SFTNGP09.phx.gb l...
> > > I'm using ASP.NET and quite a lot of object in memory instead of a
> > database.
> > >
> > > The question is that I tried to save the data, serialize them in aXML > > file
> > > to save them when the application is ending.
> > >
> > > event : Application_End in Global.asax.
> > >
> > > But the object are not accesible from there so I can't save them.
> > >
> > > Any idea ???
> > >
> > > Thanks.
> > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #8

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

Similar topics

8
2721
by: Google Mike | last post by:
I need an Application object replacement. I was creating my own using shared memory -- shm* API in PHP. I was doing fine for 6 months until it just got too fat, I guess, and the RH9 Linux server just started "losing its memory". I don't know -- perhaps I'm doing something wrong, perhaps it's my code, or perhaps there's a limitation on what I'm trying to do here. It's too many lines of code to debug right now. I'm searching for...
0
2599
by: news.skynet.be | last post by:
Hello. I am a beginner at this Java stuff, so bear with me. I have been writing an imaging application as a way of learning Java. I have got little bits working and tied them together in an application. But now I am looking to tune, or correctly model, the application use threads to improve performance.
0
361
by: Manfred Braun | last post by:
Hi All, I am trying to fetch system-events, and I am successful with "TimeChanged", but cannot get "SessionEnding". I am not an OO expert and so - just to be sure - I made all my methods public and static, this this does'nt seem to help. Could someone plesase help? My code is below:
9
2824
by: Rajat Tandon | last post by:
Hello there, I am relatively new to the newsgroups and C#. I have never been disappointed with the groups and always got the prompt replies to my queries.This is yet another strange issue, I am facing. Please please help me to solve this as soon as possible. So here we go ... I am not able to take the screen shot of the windows form based "Smart
9
2453
by: William LaMartin | last post by:
I have a problem, mentioned here before, of Session and Application variables disappearing at one site but not at others or on my development computer. The problem is illustrated by an example at http://www.lamartin.com/dotnet/sessiontestset.aspx, were I set Session, Application and Cache variables on the first page and then on the second page view them as the second page is refreshed every five seconds. Before 10 refreshes, the...
3
1538
by: spammy | last post by:
hi all, im currently writing an ASP.net front end to display data found in an XML file. the XML file is quite large (700k or so), and so takes a while to load. it will be changing around every second, so needs to be loaded at least at that rate. at the moment, the ASP application loads the xml every refresh - im thinking that this may cause problems when there are 20 clients each refreshing once per second. the solution im thinking of...
4
3719
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml file via some editable controls such as text boxes , option boxes etc. how can i implment this , should i use another xslt file with <INPUT> controls . if so how can i save the result back using the asp.net
1
2978
by: modi321 | last post by:
Everyone, I have a question on how to use persistant application settings with 2.0. I understand I can use defined types like ints, strings, and so on, but how about my own custom class? The problem is I can fill in the 'type' of the setting as my custom class, but if I try to save the settings - calling the My.Settings.Save() - then reload the settings at a later time with the My.Settings.Reload() - the data in my custom class is not...
14
3449
by: fdu.xiaojf | last post by:
Hi, I have a program which will continue to run for several days. When it is running, I can't do anything except waiting because it takes over most of the CUP time. Is it possible that the program can save all running data to a file when I want it to stop, and can reload the data and continue to run from where it stops when the computer is free ?
0
9464
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
10292
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10122
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...
1
10061
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9923
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...
0
8954
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6722
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();...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.