Show / Hide Table of Contents

Class ConfigurationSetManager

Responsible for creating, deleting and checking for the existence of configuration sets.

Inheritance
System.Object
ConfigurationSetManager
Namespace: MESL.SqlRace.Domain
Assembly: MESL.SqlRace.Domain.dll
Syntax
public class ConfigurationSetManager : Object, IConfigurationSetManager
Remarks

Then ConfigurationSetManager will return a ConfigurationSet instance when the Create method is called which can then be used to add new configuration items.

Examples

The following is an example of using the ConfigurationSetManager to create a ConfigurationSet to add a simple shared configuration set:

// Local database connection string
string connectionString = @"Data Source=.\sqlexpress;Initial Catalog=SQLRACE01;Integrated Security=SSPI";

// Initialise SQL Race
Core.Initialize();

// Create simple configuration Set
ConfigurationSetManager configSetManager = ConfigurationSetManager.CreateConfigurationSetManager();
ConfigurationSet configSet = configSetManager.Create(connectionString, "Configuration set name", "Configuration set description");
configSet.AddParameter(new Parameter("Identifier", "Name", "Description", 1000, 0, 1000, 0, 0, 0xFF, 0, "RationalConversion", 1));
configSet.AddChannel(new Channel(1, "Name", 100, DataType.Unsigned8Bit, ChannelDataSourceType.Periodic));
configSet.AddConversion(new RationalConversion("RationalConversion", "units", "format", 0, 1, 0, 0, 0, 1));
try
{
  configSet.Commit();
} 
catch (ConfigurationSetAlreadyExistsException ex)
{
 // ConfigurationSet can be committed only once. It cannot be updated - new ConfigurationSet should be created instead
 Log.Warn($"Commit of a ConfigurationSet {configurationSet.Identifier} failed. The config set already exists"); 
}

An instance of ConfigurationSet can be committed once only.

Constructors

ConfigurationSetManager()

Declaration
public ConfigurationSetManager()

Properties

SessionId

Session Id that this Configuration Set Manager is assigned to.

Declaration
public int SessionId { get; set; }
Property Value
Type Description
System.Int32

Methods

AddFastConfiguration(ConnectionInformationBase, String, FastConfigFlags, Byte[])

Adds the specified Fast Configuration data (not a configuration set).

Declaration
public void AddFastConfiguration(ConnectionInformationBase connectionInformation, string hash, FastConfigFlags flags, byte[] fastConfigData)
Parameters
Type Name Description
ConnectionInformationBase connectionInformation

Connection.

System.String hash

Fast Configuration hash (lower-case hex).

MAT.OCS.FFC.Configuration.Format.FastConfigFlags flags

Option flags.

System.Byte[] fastConfigData

Fast Configuration Data.

Exceptions
Type Condition
System.InvalidOperationException

When SupportsFastConfiguration(ConnectionInformationBase) returns false.

AddFastConfigurationSet(ConnectionInformationBase, String, String, UInt32, FastConfigurationSetAttributes, Byte[], out Boolean)

Adds the specified Fast Configuration set without mounting it.

Declaration
public int AddFastConfigurationSet(ConnectionInformationBase connectionInformation, string identifier, string description, uint ownerId, FastConfigurationSetAttributes fastConfigAttributes, byte[] fastConfigData, out bool created)
Parameters
Type Name Description
ConnectionInformationBase connectionInformation

Connection.

System.String identifier

Configuration set identifier.

System.String description

Configuration set description.

System.UInt32 ownerId

Team id.

FastConfigurationSetAttributes fastConfigAttributes

Fast Configuration attributes (hash and option flags).

System.Byte[] fastConfigData

Fast Configuration data.

System.Boolean created

Output parameter - true if this resulted in a new configuration set, or false if one already existed.

Returns
Type Description
System.Int32

Database id.

Exceptions
Type Condition
System.InvalidOperationException

When SupportsFastConfiguration(ConnectionInformationBase) returns false.

Create(SessionKey, ConnectionInformationBase, String, String, Boolean, Boolean)

Creates an in-memory configuration set object. The configuration will be saved only when Commit() is called.

Declaration
public ConfigurationSet Create(SessionKey key, ConnectionInformationBase connectionInformation, string identifier, string description, bool commitToDatabase = true, bool transient = false)
Parameters
Type Name Description
MAT.OCS.Core.SessionKey key

The key of the session this is associated with.

ConnectionInformationBase connectionInformation

The connection

System.String identifier

The configuration set identifier

System.String description

The configuration set description

System.Boolean commitToDatabase

Generate persist function for created configuration set.

System.Boolean transient

Flag configuration set as transient

Returns
Type Description
ConfigurationSet

A ConfigurationSet instance

Exceptions
Type Condition
System.ArgumentException

Thrown if the identifier is null or an empty string

Create(SessionKey, String, String, String, Boolean, Boolean)

Creates an in-memory configuration set object. The configuration will be saved only when Commit() is called.

Declaration
public ConfigurationSet Create(SessionKey key, string connectionString, string identifier, string description, bool commitToDatabase = true, bool transient = false)
Parameters
Type Name Description
MAT.OCS.Core.SessionKey key

The key of the session this is associated with.

System.String connectionString

The connection string

System.String identifier

The configuration set identifier

System.String description

The configuration set description

System.Boolean commitToDatabase

Generate persist function for created configuration set.

System.Boolean transient

Flag configuration set as transient

Returns
Type Description
ConfigurationSet

A ConfigurationSet instance

Exceptions
Type Condition
System.ArgumentException

Thrown if the identifier is null or an empty string

Create(ConnectionInformationBase, String, Boolean)

Creates an in-memory configuration set object. The configuration will be saved only when Commit() is called.

Declaration
public ConfigurationSet Create(ConnectionInformationBase connectionInformation, string identifier, bool commitToDatabase = true)
Parameters
Type Name Description
ConnectionInformationBase connectionInformation

The connection

System.String identifier

The configuration set identifier

System.Boolean commitToDatabase
Returns
Type Description
ConfigurationSet

A ConfigurationSet instance

Exceptions
Type Condition
System.ArgumentException

Thrown if the identifier is null or an empty string

Create(ConnectionInformationBase, String, String, Boolean, Boolean)

Creates an in-memory configuration set object. The configuration will be saved only when Commit() is called.

Declaration
public ConfigurationSet Create(ConnectionInformationBase connectionInformation, string identifier, string description, bool commitToDatabase = true, bool transient = false)
Parameters
Type Name Description
ConnectionInformationBase connectionInformation

The connection

System.String identifier

The configuration set identifier

System.String description

The configuration set description

System.Boolean commitToDatabase

Generate persist function for created configuration set.

System.Boolean transient

Flag configuration set as transient

Returns
Type Description
ConfigurationSet

A ConfigurationSet instance

Exceptions
Type Condition
System.ArgumentException

Thrown if the identifier is null or an empty string

Create(String, String, Boolean)

Creates an in-memory configuration set object. The configuration will be saved only when Commit() is called.

Declaration
public ConfigurationSet Create(string connectionString, string identifier, bool commitToDatabase = true)
Parameters
Type Name Description
System.String connectionString

The connection string

System.String identifier

The configuration set identifier

System.Boolean commitToDatabase

Generate persist function for created configuration set.

Returns
Type Description
ConfigurationSet

A ConfigurationSet instance

Exceptions
Type Condition
System.ArgumentException

Thrown if the identifier is null or an empty string

Create(String, String, String, Boolean, Boolean)

Creates an in-memory configuration set object. The configuration will be saved only when Commit() is called.

Declaration
public ConfigurationSet Create(string connectionString, string identifier, string description, bool commitToDatabase = true, bool transient = false)
Parameters
Type Name Description
System.String connectionString

The connection string

System.String identifier

The configuration set identifier

System.String description

The configuration set description

System.Boolean commitToDatabase

Generate persist function for created configuration set.

System.Boolean transient

Flag configuration set as transient

Returns
Type Description
ConfigurationSet

A ConfigurationSet instance

Exceptions
Type Condition
System.ArgumentException

Thrown if the identifier is null or an empty string

CreateConfigurationSetManager()

Kris L - deprecated. replace references in A9, A10 and remove

Declaration
public static ConfigurationSetManager CreateConfigurationSetManager()
Returns
Type Description
ConfigurationSetManager

Delete(ConnectionInformationBase, String)

Deletes the configuration set from SQL Race.

Declaration
public void Delete(ConnectionInformationBase connectionInformation, string identifier)
Parameters
Type Name Description
ConnectionInformationBase connectionInformation

The connection

System.String identifier

The configuration set identifier

Exceptions
Type Condition
System.ArgumentException

Thrown if the identifier is null or an empty string

Delete(String, String)

Deletes the configuration set from SQL Race.

Declaration
public void Delete(string connectionString, string identifier)
Parameters
Type Name Description
System.String connectionString

The connection string

System.String identifier

The configuration set identifier

Exceptions
Type Condition
System.ArgumentException

Thrown if the identifier is null or an empty string

Exists(ConnectionInformationBase, String)

Checks if the configuration set exists in the SQLRace Database.

Declaration
public bool Exists(ConnectionInformationBase connectionInformation, string identifier)
Parameters
Type Name Description
ConnectionInformationBase connectionInformation

The connection

System.String identifier

The configuration set identifier

Returns
Type Description
System.Boolean

True if the configuration set exists, otherwise False

Exceptions
Type Condition
System.ArgumentException

Thrown if the identifier is null or an empty string

Exists(ConnectionInformationBase, String, out FastConfigurationSetAttributes)

Checks if the configuration set exists in the SQLRace Database, returning FastConfigurationSetAttributes via fastConfigAttributes or null if the configuration set does not have associated fast configuration.

Declaration
public bool Exists(ConnectionInformationBase connectionInformation, string identifier, out FastConfigurationSetAttributes fastConfigAttributes)
Parameters
Type Name Description
ConnectionInformationBase connectionInformation

The connection

System.String identifier

The configuration set identifier

FastConfigurationSetAttributes fastConfigAttributes

Fast Configuration Attributes which correspond ti the identifier.

Returns
Type Description
System.Boolean

True if the configuration set exists, otherwise False

Exceptions
Type Condition
System.ArgumentException

Thrown if the identifier is null or an empty string

GetFastConfiguration(ConnectionInformationBase, String)

Gets Fast Configuration data (not a configuration set) for the specified hash.

Declaration
public byte[] GetFastConfiguration(ConnectionInformationBase connectionInformation, string hash)
Parameters
Type Name Description
ConnectionInformationBase connectionInformation

Connection.

System.String hash

Fast Configuration hash (lower-case hex).

Returns
Type Description
System.Byte[]

Fast Configuration data, or null.

Exceptions
Type Condition
System.InvalidOperationException

When SupportsFastConfiguration(ConnectionInformationBase) returns false.

Purge(String)

Purges unused configuration sets from the SQL Race

Declaration
public int Purge(string connectionString)
Parameters
Type Name Description
System.String connectionString

The connection string

Returns
Type Description
System.Int32

SupportsFastConfiguration(ConnectionInformationBase)

Returns whether the specified connection supports Fast Configuration.

Declaration
public bool SupportsFastConfiguration(ConnectionInformationBase connectionInformation)
Parameters
Type Name Description
ConnectionInformationBase connectionInformation

Connection.

Returns
Type Description
System.Boolean

true if Fast Configuration is supported.

UpgradeConfigurationSet(ConnectionInformationBase, Int32, String)

Upgrades the specified configuration set by associating it with Fast Configuration.

Declaration
public void UpgradeConfigurationSet(ConnectionInformationBase connectionInformation, int configurationSetId, string fastConfigurationHash)
Parameters
Type Name Description
ConnectionInformationBase connectionInformation

Connection.

System.Int32 configurationSetId

Configuration set database id.

System.String fastConfigurationHash

Fast Configuration hash (lower-case hex).

Exceptions
Type Condition
System.InvalidOperationException

When SupportsFastConfiguration(ConnectionInformationBase) returns false.

Back to top Generated by DocFX