IConfig Interface |
Provide an access to the configuration.
Namespace: AskiaPortalCmn.Configuration
The IConfig type exposes the following members.
Name | Description | |
---|---|---|
ItemConfigKey |
Get the configuration item in the `askiaportal` namespace
| |
ItemString, NullableGuid |
Get the configuration item of the specified module.
| |
MainDatabase |
Get the connection of the main SQL database
| |
RootPath |
Get the root path of the configuration directory
| |
TestDatabase |
Get or set the connection of the test SQL database
| |
TestLicensesKey |
Get the licenses key for the unit tests.
|
Name | Description | |
---|---|---|
ApplyRecordedChanges |
Save configuration item that has
been changed since the initialization,
and reload the configuration in order
to make the changes visible.
| |
Contains |
Indicates if the specified item is contains in the configuration of the specified module.
| |
FindAllReferences(ValueReference, Guid) |
Get the list of configuration item that refers
to the specified item.
| |
FindAllReferences(ValueReference, Int32) |
Get the list of configuration item that refers
to the specified item.
| |
GetEnumerator | Returns an enumerator that iterates through the collection. (Inherited from IEnumerableIConfigItem.) | |
RecordChange(IContext, ConfigKey, Boolean) |
Record a new value for the specified configuration item. It will not apply the change in the configuration, nor save in the database unless you explicitly call the ApplyRecordedChanges(IContext) method. | |
RecordChange(IContext, ConfigKey, Double) |
Record a new value for the specified configuration item. It will not apply the change in the configuration, nor save in the database unless you explicitly call the ApplyRecordedChanges(IContext) method. | |
RecordChange(IContext, ConfigKey, Guid) |
Record a new value for the specified configuration item. It will not apply the change in the configuration, nor save in the database unless you explicitly call the ApplyRecordedChanges(IContext) method. | |
RecordChange(IContext, ConfigKey, Int32) |
Record a new value for the specified configuration item. It will not apply the change in the configuration, nor save in the database unless you explicitly call the ApplyRecordedChanges(IContext) method. | |
RecordChange(IContext, ConfigKey, String) |
Record a new value for the specified configuration item. It will not apply the change in the configuration, nor save in the database unless you explicitly call the ApplyRecordedChanges(IContext) method. | |
RecordChange(IContext, String, Boolean, NullableGuid) |
Record a new value for the specified configuration item. It will not apply the change in the configuration, nor save in the database unless you explicitly call the ApplyRecordedChanges(IContext) method. | |
RecordChange(IContext, String, Double, NullableGuid) |
Record a new value for the specified configuration item. It will not apply the change in the configuration, nor save in the database unless you explicitly call the ApplyRecordedChanges(IContext) method. | |
RecordChange(IContext, String, Guid, NullableGuid) |
Record a new value for the specified configuration item. It will not apply the change in the configuration, nor save in the database unless you explicitly call the ApplyRecordedChanges(IContext) method. | |
RecordChange(IContext, String, Int32, NullableGuid) |
Record a new value for the specified configuration item. It will not apply the change in the configuration, nor save in the database unless you explicitly call the ApplyRecordedChanges(IContext) method. | |
RecordChange(IContext, String, String, NullableGuid) |
Record a new value for the specified configuration item. It will not apply the change in the configuration, nor save in the database unless you explicitly call the ApplyRecordedChanges(IContext) method. | |
Reload |
Reload the configuration using the current database
values.
|
Singleton object, use the GetInstance to instantiate it.
It open the AskiaPortal.config store in ProgramData\AskiaPortal folder.
The content of the config file should looks like this:
<configuration version="1.0"><askiaportalcmn><settings key="mainDatabase" value="Data Source=[SERVER];Initial Catalog=AskiaPortal;Persist Security Info=True;User ID=[USER_ID];Password=[PASSWORD];" /><settings key="testDatabase" value="Data Source=[SERVER];Initial Catalog=AskiaPortalTest;Persist Security Info=True;User ID=[USER_ID];Password=[PASSWORD];" /></askiaportalcmn></configuration>
Basic usage:
using AskiaPortalCmn.Configuration; // ... var config = Config.GetInstance(); Console.WriteLine("The path of the AskiaPortal configuration directory is `{0}`", config.RootPath); Console.WriteLine("The connection string of the main database (AskiaPortal) is `{0}`", config.MainDatabase);