I have never used global constants and I am a bit confused on the
subject.
I want to give the admin of an application a lot of control over
display.
i.e. custom error messages, number of rows displayed, etc.
Assuming that all these 'constants' are stored in a database table,
what is the best way of incorporating them into the application?
Should I used global.asax, i.e. make a call to the database, loop
through the values and declare them as constants? If so, can somebody
give me a few lines of code as an example? Are there any better ways?
> Assuming that all these 'constants' are stored in a database table,
> what is the best way of incorporating them into the application?
How "constant" are they? Do they change never, occasionally, sometimes,
quite often, all the time...?
> Should I used global.asax, i.e. make a call to the database, loop
> through the values and declare them as constants? If so, can somebody
> give me a few lines of code as an example? Are there any better ways?
Whenever I have a smallish amount of static data which is accessed lots of
times in the web app, I tend to read it into a Hashtable in the
Application_Start event and thereafter read it from there rather than
constantly querying the database for the same piece of data over and over
again.
A good example of this are countries and currencies. They hardly ever
change, so it doesn't make sense to keep looking them up...
Just create a class like class1
Public Const Hello As String = "hello"
then access it through: class1.Hello
No need to create a class instance.
Public functions:
Public Shared Function....
No need to create a class instance.
"Steve" <bah...@iranmania.com> schreef in bericht
news:1133279390....@g44g2000cwa.googlegroups.com...
We use Enterprise Library 2005's configuration application block. It enables
you to store all application specific configuration information in a config
file (separate from the web.config to keep it from becoming messy) and
allows you to use a generic API provided by the configuration block to read
back values. The Enterprise Library 2005 comes with a configuration tool to
enable your application admin to modify the config files. This article
http://weblogs.asp.net/pgielens/archive/2005/05/16/406911.aspx explains how
to do this.
Best regards,
Paul Gielens
Visit my blog @ http://weblogs.asp.net/pgielens/
###
"Steve" <bah...@iranmania.com> wrote in message
news:1133279390....@g44g2000cwa.googlegroups.com...
So a simple dummy-must-fill text file could do.
You simply drop the file once on a resource.rex (whatever it's name) part
and you are ready.
"Steve" <bah...@iranmania.com> schreef in bericht
news:1133293573.7...@o13g2000cwo.googlegroups.com...
> Well I am thinking it might be changed fairly frequently, once every 2
> days say.
LOL! Well they're not constant, are they... :-)