V
V. Jenks
I have a C# class that generates a string based on 2
integers. One integer is equal to int.MinValue and the
other is equal to int.MaxValue. Each time my class
generates a new string from those 2 numbers, one of the
integers is incremented.
What I need is a way to safely store the current string and
the 2 integers in a way that will guarantee I do not lose
the values, it is important that each time I generate the
string, it is unique, as it is used as a primary key in my
database tables.
If I were to load the values from say, an XML file when the
program loads in Application_Start in the Global.asax
code-behind, could I safely keep them in memory and are
they guaranteed to remain in state while the application is
running? I was thinking I would re-write the values back
into the XML file in the Application_End event handler.
BUT...when exactly is Application_Start fired and when
exactly is Application_End fired? What constitutes a web
application starting and ending? Does it end when there
are no more active sessions in the app?
Could I safely pull this off w/o any concurrency problems
when writing/reading to the XML files to get my values?
I would store these values in a database table but I don't
want to make a new connection and round-trip to the
database every time I need a value to insert as a primary
key, this would murder my app's performance.
integers. One integer is equal to int.MinValue and the
other is equal to int.MaxValue. Each time my class
generates a new string from those 2 numbers, one of the
integers is incremented.
What I need is a way to safely store the current string and
the 2 integers in a way that will guarantee I do not lose
the values, it is important that each time I generate the
string, it is unique, as it is used as a primary key in my
database tables.
If I were to load the values from say, an XML file when the
program loads in Application_Start in the Global.asax
code-behind, could I safely keep them in memory and are
they guaranteed to remain in state while the application is
running? I was thinking I would re-write the values back
into the XML file in the Application_End event handler.
BUT...when exactly is Application_Start fired and when
exactly is Application_End fired? What constitutes a web
application starting and ending? Does it end when there
are no more active sessions in the app?
Could I safely pull this off w/o any concurrency problems
when writing/reading to the XML files to get my values?
I would store these values in a database table but I don't
want to make a new connection and round-trip to the
database every time I need a value to insert as a primary
key, this would murder my app's performance.