Running asp.net 2.0
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? 8 1374
"Steve" <ba****@iranmania.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com... 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...
Contants IN DB ???
Nahh.
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" <ba****@iranmania.com> schreef in bericht
news:11*********************@g44g2000cwa.googlegro ups.com... Running asp.net 2.0
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?
Hi Steve,
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/arch...16/406911.aspx explains how
to do this.
EntLib 2005 http://www.microsoft.com/downloads/d...displaylang=en
Best regards,
Paul Gielens
Visit my blog @ http://weblogs.asp.net/pgielens/
###
"Steve" <ba****@iranmania.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com... Running asp.net 2.0
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?
Well I am thinking it might be changed fairly frequently, once every 2
days say.
I like this idea, but I don't want a non-tech admin editing a .vb file,
that's why I am think of using a database which can be updated online.
I like this idea, but I don't want a non-tech admin editing a .vb file,
that's why I am think of using a database which can be updated online.
That's really not necessary.
A simple resource text file could do.
I assume IIS/.NET will recompile resources as well when they are changed.
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" <ba****@iranmania.com> schreef in bericht
news:11**********************@o13g2000cwo.googlegr oups.com... I like this idea, but I don't want a non-tech admin editing a .vb file, that's why I am think of using a database which can be updated online.
"Steve" <ba****@iranmania.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com... Well I am thinking it might be changed fairly frequently, once every 2 days say.
LOL! Well they're not constant, are they... :-) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Raymond Hettinger |
last post by:
Comments are invited on the following proposed PEP.
Raymond Hettinger
-------------------------------------------------------
PEP: 329
|
by: David W. Fenton |
last post by:
Today I was working on a hideous old app that I created a long time
ago that does a lot of showing/hiding/resizing of fields on one of
the forms. I had used constants to store reference values for...
|
by: Amadelle |
last post by:
Hi all and thanks again in advance,
What is the best way of defining global constants in a C# application? (A
windows application with no windows forms - basically a set of classes).
Would it be...
|
by: Marty |
last post by:
Hi,
I'm new to C#, I used to code in VB.NET. Where is the best place to
declare all my constants and global objects in my C# project to have
them accessible globally?
I have an event logger...
|
by: newsposter0123 |
last post by:
The code block below initialized a r/w variable (usually .bss) to the
value of pi. One, of many, problem is any linked compilation unit may
change the global variable. Adjusting
// rodata
const...
|
by: PC |
last post by:
Gentlesofts,
Forgive me. I'm an abject newbie in your world, using VB 2005 with the
dot-Net wonderfulness.
So, I'm writing a wonderful class or two to interface with a solemnly
ancient...
|
by: Neil Cerutti |
last post by:
The Glk API (which I'm implementing in native Python code)
defines 120 or so constants that users must use. The constants
already have fairly long names, e.g., gestalt_Version,
evtype_Timer,...
|
by: Leslie Sanford |
last post by:
I want to define a set of floating point constants using templates insteand
of macros. I'd like to determine whether these constants are floats or
doubles at compile time. In my header file, I have...
|
by: shuisheng |
last post by:
Dear All,
I am always confused in using constants in multiple files.
For global constants, I got some clues from
http://msdn.microsoft.com/en-us/library/0d45ty2d(VS.80).aspx
So in header...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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,...
|
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...
|
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,...
|
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...
| |