Class Core
Provides methods to initialize SQL Race and change settings such as logging level and cache size.
Inheritance
Namespace: MESL.SqlRace.Domain
Assembly: MESL.SqlRace.Domain.dll
Syntax
public static class Core : Object
Remarks
Before many methods of the SQL Race API can be used, Initialize
must be called. This method initializes the
API and configures internal settings.
Properties
ConfigurationProcessingMetricsEnabled
Gets/sets whether metrics are logged for session configuration processing (loading historic, and live). Logging is disabled by default.
Before enabling, configure NLog to route Trace-level logs for ConfigurationProcessingMetrics
into a
file, using bare messsages (no time or level info) and final
to terminate rule processing.
This should yield clean tabular data for analysis.
Declaration
public static bool ConfigurationProcessingMetricsEnabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsInitialized
Gets a value indicating whether the Core has been initialized.
Declaration
public static bool IsInitialized { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsShutdown
Gets or sets a value indicating whether sqlrace is shutdown.
Declaration
public static bool IsShutdown { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
LicenceOwnerName
Gets the current licence owners name
Declaration
public static string LicenceOwnerName { get; }
Property Value
Type | Description |
---|---|
System.String |
LicenceProgramName
Gets or sets the name of the licence program.
Declaration
public static string LicenceProgramName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name of the licence program. |
Methods
CheckInitialized()
Checks that the SQL Race API has been initialized.
Declaration
public static void CheckInitialized()
Exceptions
Type | Condition |
---|---|
System.ApplicationException | Thrown if the API is not initialised via call to the Initialize method. |
ConfigureMetrics(Boolean, Boolean, IPEndPoint, String)
Configures metrics logging programmatically as an alternative to editing with the settings UI.
Declaration
public static void ConfigureMetrics(bool enableLogging, bool useExternalMetrics, IPEndPoint endPoint, string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | enableLogging | If set to |
System.Boolean | useExternalMetrics | If set to |
System.Net.IPEndPoint | endPoint | The end point. |
System.String | connectionString | The connection string. |
ConfigureServer(Boolean, IPEndPoint)
Configures SQL Race server programmatically as an alternative to editing with the settings UI.
Declaration
public static void ConfigureServer(bool startServer, IPEndPoint serverEndPoint)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | startServer | If set to |
System.Net.IPEndPoint | serverEndPoint | The server end point. |
CreateOrUpdateAPISetting(String, Object, SettingsType)
Set an application setting.
Declaration
public static void CreateOrUpdateAPISetting(string settingName, object settingValue, SettingsType settingsType)
Parameters
Type | Name | Description |
---|---|---|
System.String | settingName | |
System.Object | settingValue | |
MESL.SqlRace.Common.ConfigurationStore.SettingsType | settingsType |
CreateOrUpdateRDASetting(String, Object, SettingsType)
Set an RDA setting.
Declaration
public static void CreateOrUpdateRDASetting(string settingName, object settingValue, SettingsType settingsType)
Parameters
Type | Name | Description |
---|---|---|
System.String | settingName | |
System.Object | settingValue | |
MESL.SqlRace.Common.ConfigurationStore.SettingsType | settingsType |
Initialize()
Performs essential initialisation of the SQL Race API. Typically this must be called before many features within the API can be used.
Declaration
public static void Initialize()
SetCacheSize(Int64)
Sets the size of the cache in bytes.
Declaration
public static void SetCacheSize(long cacheSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | cacheSize | Size of the cache in bytes. |
SetLoggingLevel(LogLevel)
Sets the logging level programmatically as an alternative to editing with the settings UI.
Declaration
public static void SetLoggingLevel(LogLevel loggingLevel)
Parameters
Type | Name | Description |
---|---|---|
MESL.SqlRace.Common.LogLevel | loggingLevel | The logging level. |
TeardownMetrics()
Teardown SQLRace Metrics
Declaration
public static void TeardownMetrics()
TryGetAPISetting<T>(String, out T)
Get an application setting.
Declaration
public static bool TryGetAPISetting<T>(string settingName, out T value)
Parameters
Type | Name | Description |
---|---|---|
System.String | settingName | |
T | value |
Returns
Type | Description |
---|---|
System.Boolean |
Type Parameters
Name | Description |
---|---|
T |
TryGetRDASetting<T>(String, out T)
Get an RDA setting.
Declaration
public static bool TryGetRDASetting<T>(string settingName, out T value)
Parameters
Type | Name | Description |
---|---|---|
System.String | settingName | |
T | value |
Returns
Type | Description |
---|---|
System.Boolean |
Type Parameters
Name | Description |
---|---|
T |
ValidateLicenceOption(String)
Validate option is contained within the current program
Declaration
public static bool ValidateLicenceOption(string option)
Parameters
Type | Name | Description |
---|---|---|
System.String | option | The option to search for |
Returns
Type | Description |
---|---|
System.Boolean | Bool indicating if the option is found with the current program |
Events
CoreInitialized
Occurs when core is initialized.
Declaration
public static event EventHandler<CoreInitialisedEventArgs> CoreInitialized
Event Type
Type | Description |
---|---|
System.EventHandler<CoreInitialisedEventArgs> |
SQLRaceEvent
Occurs when a SQLRace event is fired
Declaration
public static event EventHandler<SQLRaceEvent> SQLRaceEvent
Event Type
Type | Description |
---|---|
System.EventHandler<SQLRaceEvent> |