Class ConfigurationSet
Represents a configuration set.
Inheritance
Implements
Namespace: MESL.SqlRace.Domain
Assembly: MESL.SqlRace.Domain.dll
Syntax
public class ConfigurationSet : Object, IDisposable
  Remarks
Configuration can be created independently and shared across multiple sessions (non session specific) using the ConfigurationSetManager. This will improve session creation and load time.
Configuration can also be added to a session so that it is session specific (not shared) using CreateConfiguration(). This way is now deprecated, should not be used.
A configuration set is made up of the following entities:
- Parameters
 - Channels
 - Conversions (rational, table and text conversions)
 - Application groups
 - Parameter groups
 - Error definitions
 - Event definitions
 
Examples
The following is an example of using the ConfigurationSetManager to create a
ConfigurationSet2 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();
ConfigurationSet2 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 (ConfiguraitonSetAlreadyExistsException 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"); 
}
  Fields
Disposed
The disposed
Declaration
protected bool Disposed
  Field Value
| Type | Description | 
|---|---|
| System.Boolean | 
Properties
ChannelsToLoad
The subset of parameters to to actually load
Declaration
public IList<IChannel> ChannelsToLoad { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Collections.Generic.IList<IChannel> | 
Description
Gets the configuration set description
Declaration
public string Description { get; }
  Property Value
| Type | Description | 
|---|---|
| System.String | 
Identifier
Gets the identifier.
Declaration
public string Identifier { get; }
  Property Value
| Type | Description | 
|---|---|
| System.String | 
IsCommitted
Whether the config has been committed yet.
Declaration
public bool IsCommitted { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
IsTransient
Is the configuration set transient
Declaration
public bool IsTransient { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
Metadata
The ConfigurationSetMetaData for this configuration set
Declaration
public ConfigurationSetMetaData Metadata { get; set; }
  Property Value
| Type | Description | 
|---|---|
| ConfigurationSetMetaData | 
OwnerId
Gets or sets the owner identifier.
Declaration
public uint OwnerId { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.UInt32 | The owner identifier.  | 
      
ParametersToLoad
The subset of parameters to to actually load
Declaration
public IList<ParameterBase> ParametersToLoad { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Collections.Generic.IList<ParameterBase> | 
Methods
AddChannel(IChannel)
Adds channel to the configuration set.
Declaration
public void AddChannel(IChannel channel)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IChannel | channel | Channel to add.  | 
      
AddChannels(IEnumerable<IChannel>)
Adds channels to the configuration set.
Declaration
public void AddChannels(IEnumerable<IChannel> channels)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.IEnumerable<IChannel> | channels | List of channels.  | 
      
AddConversion(ConversionBase)
Adds conversion to the configuration set.
Declaration
public void AddConversion(ConversionBase conversion)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ConversionBase | conversion | Conversion to add.  | 
      
AddConversions(IEnumerable<ConversionBase>)
Adds conversions to the configuration set.
Declaration
public void AddConversions(IEnumerable<ConversionBase> conversions)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.IEnumerable<ConversionBase> | conversions | List of conversions.  | 
      
AddErrorDefinition(ErrorDefinition)
Adds Error definition to the configuration set.
Declaration
public void AddErrorDefinition(ErrorDefinition errorDefinition)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ErrorDefinition | errorDefinition | Error definitions.  | 
      
AddErrorDefinitions(IEnumerable<ErrorDefinition>)
Adds Error definitions to the configuration set.
Declaration
public void AddErrorDefinitions(IEnumerable<ErrorDefinition> errorDefinitionItems)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.IEnumerable<ErrorDefinition> | errorDefinitionItems | List of Error definitions.  | 
      
AddEventDefinition(EventDefinition)
Adds event definitions to the configuration set.
Declaration
public void AddEventDefinition(EventDefinition eventDefinition)
  Parameters
| Type | Name | Description | 
|---|---|---|
| EventDefinition | eventDefinition | Event definition.  | 
      
AddEventDefinitions(IEnumerable<EventDefinition>)
Adds event definitions to the configuration set.
Declaration
public void AddEventDefinitions(IEnumerable<EventDefinition> definitions)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.IEnumerable<EventDefinition> | definitions | List of event definitions.  | 
      
AddGroup(ApplicationGroup)
Adds application group to the configuration set.
Declaration
public void AddGroup(ApplicationGroup applicationGroup)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ApplicationGroup | applicationGroup | Application group to add.  | 
      
AddGroups(IEnumerable<ApplicationGroup>)
Adds application groups to the configuration set.
Declaration
public void AddGroups(IEnumerable<ApplicationGroup> appGroups)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.IEnumerable<ApplicationGroup> | appGroups | List of application groups.  | 
      
AddParameter(ParameterBase)
Adds parameter to the configuration set.
Declaration
public void AddParameter(ParameterBase parameter)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ParameterBase | parameter | Parameter to add.  | 
      
AddParameterGroup(ParameterGroup)
Adds parameter group to the configuration set.
Declaration
public void AddParameterGroup(ParameterGroup parameterGroup)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ParameterGroup | parameterGroup | Parameter group.  | 
      
AddParameterGroups(IEnumerable<ParameterGroup>)
Adds parameter groups to the configuration set.
Declaration
public void AddParameterGroups(IEnumerable<ParameterGroup> parameterGroups)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.IEnumerable<ParameterGroup> | parameterGroups | List of parameter groups.  | 
      
AddParameters(IEnumerable<ParameterBase>)
Adds parameters to the configuration set.
Declaration
public void AddParameters(IEnumerable<ParameterBase> parameters)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.IEnumerable<ParameterBase> | parameters | List of parameters.  | 
      
Commit(ParameterChannelGroupMapper)
Commits the configuration set to the Database.
Declaration
public void Commit(ParameterChannelGroupMapper parameterChannelGroupMapper = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ParameterChannelGroupMapper | parameterChannelGroupMapper | The parameter channel group mapper.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| System.ApplicationException | Thrown if the configuration set already exists in SQL Race by identifier.  | 
      
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
  GetChannelsForParameter(ChannelBasedParameter, ILookup<String, IChannel>)
Made protected to facilitate testing
Declaration
protected virtual List<IChannel> GetChannelsForParameter(ChannelBasedParameter parameter, ILookup<string, IChannel> lookupByKey)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ChannelBasedParameter | parameter | |
| System.Linq.ILookup<System.String, IChannel> | lookupByKey | 
Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.List<IChannel> | 
ToString()
Returns a System.String that represents the current System.Object.
Declaration
public override string ToString()
  Returns
| Type | Description | 
|---|---|
| System.String | A System.String that represents the current System.Object.  |