Table of Contents

Class OpenSettingsConfiguration

Namespace
OpenSettings.Configurations
Assembly
OpenSettings.dll

Represents the configuration for the open settings. This class is responsible for handling different configurations based on the selected service type and the selection status.

public class OpenSettingsConfiguration
Inheritance
OpenSettingsConfiguration
Inherited Members

Constructors

OpenSettingsConfiguration()

Initializes a new instance of the OpenSettingsConfiguration class with the default service type of Provider.

public OpenSettingsConfiguration()

OpenSettingsConfiguration(ServiceType)

Initializes a new instance of the OpenSettingsConfiguration class with the specified selection representing the type of service to configure.

public OpenSettingsConfiguration(ServiceType selection)

Parameters

selection ServiceType

The type of service to be configured. This is an instance of the ServiceType enumeration. The possible values are: Provider (the provider service configuration), Consumer (the consumer service configuration)

Properties

Client

Gets or sets the client information, including the client's id, name, and secret. This information is used to identify the client.

public ClientInfo Client { get; set; }

Property Value

ClientInfo

Consumer

Gets or sets the configuration for the consumer service.

public ConsumerConfiguration Consumer { get; set; }

Property Value

ConsumerConfiguration

A ConsumerConfiguration object that holds the configuration for the consumer service.

Controller

Gets or sets the configuration for the OpenSettings controller.

public ControllerConfiguration Controller { get; set; }

Property Value

ControllerConfiguration

A ControllerConfiguration object that holds the configuration for the OpenSettings Controller.

IdentifierName

Gets or sets the case-insensitive name of the identifier. This identifier can be used to distinguish between different environments, such as Production, Development, etc.

public string IdentifierName { get; set; }

Property Value

string

The identifier name. This value can be set to any non-empty string. If the provided value is null, empty, or whitespace, the setting identifier name will remain unchanged. The default value is automatically calculates using GetEnvironmentName(). The identifier helps to differentiate settings for different application environments, like Production, Development, etc.

IgnoreOnFileChange

Gets or sets a value indicating whether changes to the settings-generated.json file should be ignored when reloading the configuration.

This property applies specifically to the general settings-generated.json file. For all other settings, unless explicitly specified in its own setting, this will be used. Its works in conjunction with the AddJsonFile(IConfigurationBuilder, string) method. When set to true, changes to the file will not trigger a reload of the configuration. When set to false, the file will be reloaded automatically if changes are detected. This property is typically used to control the reloading behavior for the main settings file.

public bool IgnoreOnFileChange { get; set; }

Property Value

bool

true to ignore changes to the settings-generated.json file; otherwise, false.

InstanceDynamicId

Assigns a random guid at runtime unless a value is manually specified.

public string InstanceDynamicId { get; set; }

Property Value

string

InstanceName

Gets or sets the case-insensitive name of the instance.

public string InstanceName { get; set; }

Property Value

string

The instance name. This value can be set to any non-empty string. If the provided value is null, empty, or whitespace, the instance name will remain unchanged. The default value is "default".

IsConsumerSelected

Gets a value indicating whether the consumer service is currently selected. This property is ignored during serialization (marked with JsonIgnoreAttribute).

[JsonIgnore]
public bool IsConsumerSelected { get; }

Property Value

bool

A boolean value that indicates if the consumer service is selected. This value is determined internally and cannot be set directly.

IsProviderSelected

Gets a value indicating whether the provider service is currently selected. This property is ignored during serialization (marked with JsonIgnoreAttribute).

[JsonIgnore]
public bool IsProviderSelected { get; }

Property Value

bool

A boolean value that indicates if the provider service is selected. This value is determined internally and cannot be set directly.

LoggerFactory

An optional logger factory used for logging information during the settings building process.

[JsonIgnore]
public ILoggerFactory LoggerFactory { get; set; }

Property Value

ILoggerFactory

Operation

Gets or sets the operation to perform during the setup process. The default is ReadOrInitialize.

public Operation Operation { get; set; }

Property Value

Operation

The Operation value indicating what operation to perform.

Provider

Gets or sets the configuration for the provider service.

public ProviderConfiguration Provider { get; set; }

Property Value

ProviderConfiguration

A ProviderConfiguration object that holds the configuration for the provider service.

RegistrationMode

Gets or sets the registration mode to use during the setup. The default is Singleton & Configure.

public RegistrationMode RegistrationMode { get; set; }

Property Value

RegistrationMode

The RegistrationMode value that determines the registration behavior.

Selection

Specifies whether the service acts as a Provider or a Consumer.

public ServiceType Selection { get; set; }

Property Value

ServiceType

Spa

Gets or sets the configuration for the OpenSettings Spa.

public SpaConfiguration Spa { get; set; }

Property Value

SpaConfiguration

A SpaConfiguration object that holds the configuration for the OpenSettings Spa.

StoreInSeparateFile

Gets or sets a value indicating whether the settings should be stored in a separate file, such as settings-generated.*.json, rather than the default settings-generated.json file.

public bool StoreInSeparateFile { get; set; }

Property Value

bool

Remarks

If not explicitly specified in the specific setting, this will be used as the default behavior for the first creation of the settings. When set to true, settings are stored in a separate file; otherwise, they are stored in the default settings-generated.json file.

SyncAppDataMaxRetryCount

Gets or sets the maximum number of retries for initial syncing data. The retry behavior is determined as follows:

  • 0 or any negative value other than -1: No retries (operation will fail immediately on failure).
  • -1: Infinite retries (operation will continue retrying until success).
  • Any positive integer: Retry up to the specified number of attempts.

By default, the value is -1, which means infinite retries. Negative values other than -1 are interpreted as "no retries" (equivalent to 0 retries), while -1 signifies infinite retries. If set to a positive value, the system will attempt the operation that many times before giving up.

If the maximum retry count is reached, a SyncAppDataMaxRetryExceededException will be thrown.
public int SyncAppDataMaxRetryCount { get; set; }

Property Value

int

SyncAppDataRetryDelayMilliseconds

Gets or sets the delay time in milliseconds between retry attempts when a sync app data operation fails.

public int SyncAppDataRetryDelayMilliseconds { get; set; }

Property Value

int

The number of milliseconds to wait before retrying a failed sync app data operation. The default value is 1000 milliseconds.