J
JezB
I have a static class that is instantiated once on Application_Start in
global.asax :-
protected void Application_Start(Object sender, EventArgs e)
{
int dialectID = 1;
Dialect.SetDialect(dialectID);
}
The static Dialect class is defined:
public class Dialect
{
public static int DialectID;
public static Placeholders Placeholders; // reference to Placeholders
class
public static void SetDialect(int dialectID)
{
DialectID = dialectID;
Placeholders = new Placeholders(DialectID);
}
//etc
}
The Placeholder class constructor fetches some data from a database and
stores it in a HybridDictionary. I want this data to only be fetched once
per user sesison and always available to all webform pages through the
Dialect class. I have tried this code and it all works but I have started to
wonder how? I have taken no steps to store either the Placeholders class nor
the Dialect class in Session or Application state, but it always seems to be
available. Is this by virtue of the Dialect class being static ?
Is this a safe and efficient way to do this ?
global.asax :-
protected void Application_Start(Object sender, EventArgs e)
{
int dialectID = 1;
Dialect.SetDialect(dialectID);
}
The static Dialect class is defined:
public class Dialect
{
public static int DialectID;
public static Placeholders Placeholders; // reference to Placeholders
class
public static void SetDialect(int dialectID)
{
DialectID = dialectID;
Placeholders = new Placeholders(DialectID);
}
//etc
}
The Placeholder class constructor fetches some data from a database and
stores it in a HybridDictionary. I want this data to only be fetched once
per user sesison and always available to all webform pages through the
Dialect class. I have tried this code and it all works but I have started to
wonder how? I have taken no steps to store either the Placeholders class nor
the Dialect class in Session or Application state, but it always seems to be
available. Is this by virtue of the Dialect class being static ?
Is this a safe and efficient way to do this ?