473,396 Members | 1,914 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,396 software developers and data experts.

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 1255
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.com...
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******************@TK2MSFTNGP09.phx.gbl...
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**@aspalliance.com-NOSPAM> wrote in
message news:%2****************@tk2msftngp13.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******************@TK2MSFTNGP09.phx.gbl...
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**************@TK2MSFTNGP14.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**@aspalliance.com-NOSPAM> wrote in
message news:%2****************@tk2msftngp13.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******************@TK2MSFTNGP09.phx.gbl...
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**@aspalliance.com-NOSPAM> wrote in
message news:%2******************@TK2MSFTNGP09.phx.gbl...
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**************@TK2MSFTNGP14.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**@aspalliance.com-NOSPAM> wrote in
message news:%2****************@tk2msftngp13.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******************@TK2MSFTNGP09.phx.gbl...
> 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**@aspalliance.com-NOSPAM> wrote in
message news:%2******************@TK2MSFTNGP09.phx.gbl...
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**************@TK2MSFTNGP14.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**@aspalliance.com-NOSPAM> wrote in
> message news:%2****************@tk2msftngp13.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******************@TK2MSFTNGP09.phx.gbl...
> > > 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
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...
0
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...
0
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...
9
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...
9
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...
3
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...
4
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...
1
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...
14
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...
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
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,...
0
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...
0
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,...
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.