Constant Values

General information

Constant Values refer to variables whose value cannot be changed, i.e. they are not "variable" and are thus called "Constants". They are recognized by the "static" key word and they are "hard-coded" (i.e. their value is not set dynamically but statically in the source code since they cannot be changed anyway). Their names are conventionally written in all caps, which is why they are also often called "Macros". The following shows an example of a Constant Value:

public static string ACTIONALLOWED = "ActionAllowed";

ConstantKey.cs

In our applications, all Constant Values are stored in the "ConstantKey.cs" file. Having all of them stored in one place serves the purpose of easier navigation, i.e. it is easier to find their definitions and to have an overview of which Constants are available in total.

Generally, it should be avoided to use Constant Values. However, if it becomes necessary, it should be done in this "ConstantKey.cs" file.

The Constants within this file are categorized in groups that will be explained in the following:

TABLE_KEYVALUELISTS

The group "TABLE_KEYVALUELISTS" contains Constants that store the Key Values belonging to different Dropdown Lists whose option values are fixed. They are named the same as the Key Values that they store, only that they are written in all caps and are preceded by "LOV" (abbreviation for "List of Values").

Those Key Values are used in the "SelectionOptions" Data Table, where the fixed option values are stored, to map them to the correct Dropdown List. The whole process of populating the correct Dropdown List is handled by the OptionHelper class.

CONSTANT STRING

The group "CONSTANT STRING" contains frequently used strings for miscellaneous purposes.

CACHEKEY

The group "CACHEKEY" contains cache keys, which are unique identifiers associated with specific data in the cache (temporary storage area for frequently accessed data in memory), so that the caching system can quickly look up the data when it is needed, without having to search through the entire cache or to query the database to retrieve the data.

API ENDPOINT

The group "API ENDPOINT" contains URLs that serve the purpose of being an API endpoint, i.e. by sending a request to this URL, one can access a specific functionality or service provided by the web application or web service through its API.

Last updated