ConfigurationExtensions

Namespace: Proffer.Storage.Configuration

Extensions methods to parse and bind options.

public static class ConfigurationExtensions

Inheritance ObjectConfigurationExtensions

Methods

Parse<TOptions>(IReadOnlyDictionary<String, IConfigurationSection>)

Parses the specified unparsed configuration.

public static IReadOnlyDictionary<string, TOptions> Parse<TOptions>(IReadOnlyDictionary<string, IConfigurationSection> unparsedConfiguration)

Type Parameters

TOptions
The type of the options.

Parameters

unparsedConfiguration IReadOnlyDictionary<String, IConfigurationSection>
The unparsed configuration.

Returns

IReadOnlyDictionary<String, TOptions>
A typed dictionary with options binding from the given unparsed configuration.

GetStoreConfiguration<TInstanceOptions, TStoreOptions, TScopedStoreOptions>(IParsedOptions<TInstanceOptions, TStoreOptions, TScopedStoreOptions>, String, Boolean)

Gets the store configuration.

public static TStoreOptions GetStoreConfiguration<TInstanceOptions, TStoreOptions, TScopedStoreOptions>(IParsedOptions<TInstanceOptions, TStoreOptions, TScopedStoreOptions> parsedOptions, string storeName, bool throwIfNotFound)

Type Parameters

TInstanceOptions
The type of the provider instance options.

TStoreOptions
The type of the store options.

TScopedStoreOptions
The type of the scoped store options.

Parameters

parsedOptions IParsedOptions<TInstanceOptions, TStoreOptions, TScopedStoreOptions>
The parsed options.

storeName String
The name of the store.

throwIfNotFound Boolean
If set to true, throws an exception if the store configuration is not found.

Returns

TStoreOptions
The typed store configuration.

Exceptions

StoreNotFoundException

GetScopedStoreConfiguration<TInstanceOptions, TStoreOptions, TScopedStoreOptions>(IParsedOptions<TInstanceOptions, TStoreOptions, TScopedStoreOptions>, String, Boolean)

Gets the scoped store configuration.

public static TScopedStoreOptions GetScopedStoreConfiguration<TInstanceOptions, TStoreOptions, TScopedStoreOptions>(IParsedOptions<TInstanceOptions, TStoreOptions, TScopedStoreOptions> parsedOptions, string storeName, bool throwIfNotFound)

Type Parameters

TInstanceOptions
The type of the provider instance options.

TStoreOptions
The type of the store options.

TScopedStoreOptions
The type of the scoped store options.

Parameters

parsedOptions IParsedOptions<TInstanceOptions, TStoreOptions, TScopedStoreOptions>
The parsed options.

storeName String
The name of the store.

throwIfNotFound Boolean
If set to true, throws an exception if the store configuration is not found.

Returns

TScopedStoreOptions
The typed scoped store configuration.

Exceptions

StoreNotFoundException

Compute<TParsedOptions, TProviderOptions, TStoreOptions, TScopedStoreOptions>(TProviderOptions, TParsedOptions)

Computes the specified options.

public static void Compute<TParsedOptions, TProviderOptions, TStoreOptions, TScopedStoreOptions>(TProviderOptions providerOptions, TParsedOptions options)

Type Parameters

TParsedOptions
The type of the parsed options.

TProviderOptions
The type of the provider instance options.

TStoreOptions
The type of the store options.

TScopedStoreOptions
The type of the scoped store options.

Parameters

providerOptions TProviderOptions
The provider options.

options TParsedOptions
The options.

Exceptions

BadProviderConfiguration

Compute<TParsedOptions, TInstanceOptions, TStoreOptions, TScopedStoreOptions>(TStoreOptions, TParsedOptions)

Computes the specified options.

public static void Compute<TParsedOptions, TInstanceOptions, TStoreOptions, TScopedStoreOptions>(TStoreOptions parsedStore, TParsedOptions options)

Type Parameters

TParsedOptions
The type of the parsed options.

TInstanceOptions
The type of the provider instance options.

TStoreOptions
The type of the store options.

TScopedStoreOptions
The type of the scoped store options.

Parameters

parsedStore TStoreOptions
The parsed store options.

options TParsedOptions
The options.

Exceptions

BadStoreConfiguration

ParseStoreOptions<TParsedOptions, TInstanceOptions, TStoreOptions, TScopedStoreOptions>(IStoreOptions, TParsedOptions)

Parses the store options.

public static TStoreOptions ParseStoreOptions<TParsedOptions, TInstanceOptions, TStoreOptions, TScopedStoreOptions>(IStoreOptions storeOptions, TParsedOptions options)

Type Parameters

TParsedOptions
The type of the parsed options.

TInstanceOptions
The type of the provider instance options.

TStoreOptions
The type of the store options.

TScopedStoreOptions
The type of the scoped store options.

Parameters

storeOptions IStoreOptions
The store options.

options TParsedOptions
The options.

Returns

TStoreOptions
The parsed store options.