Class FluentJsonSettings
- Namespace
- Nucs.JsonSettings
- Assembly
- Nucs.JsonSettings.dll
public static class FluentJsonSettings
- Inheritance
-
FluentJsonSettings
- Inherited Members
Methods
LoadNow<T>(T)
Performs Load on the JsonSettings, used after calling Configure(Type, string) to perform a load at the end.
Uses FileName.
public static T LoadNow<T>(this T _instance) where T : JsonSettings
Parameters
_instanceTThe instance of type JsonSettings
Returns
- T
Self
Type Parameters
T
LoadNow<T>(T, string)
Performs Load on the JsonSettings, used after calling Configure(Type, string) to perform a load at the end.
public static T LoadNow<T>(this T _instance, string filename) where T : JsonSettings
Parameters
_instanceTThe instance of type JsonSettings
filenamestringSpecific file to load (ignores FileName)
Returns
- T
Self
Type Parameters
T
WithBase64<T>(T)
public static T WithBase64<T>(this T _instance) where T : JsonSettings
Parameters
_instanceT
Returns
- T
Type Parameters
T
WithDefaultValues<T>(T, Action<T>)
Fluently do something with self.
public static T WithDefaultValues<T>(this T _instance, Action<T> @do) where T : JsonSettings
Parameters
_instanceTdoAction<T>
Returns
- T
Self
Type Parameters
T
WithEncryptionRawKey<T>(T, byte[])
Attaches EncryptionModule using key verbatim as the AES
key, with no key derivation. The key must be 16, 24 or 32 bytes (AES-128/192/256). For
callers that already hold key material; the caller owns the key's quality, since PBKDF2
stretching is skipped.
public static T WithEncryptionRawKey<T>(this T _instance, byte[] key) where T : JsonSettings
Parameters
_instanceTkeybyte[]The raw AES key, 16/24/32 bytes.
Returns
- T
Self
Type Parameters
T
WithEncryptionRawKey<T>(T, byte[], EncryptionAlgorithm, KeySize)
Attaches an EncryptionModule using a raw key with algorithm
and keySize. The key length must match the algorithm (16/24/32 bytes for
AES; 32 for ChaCha20-Poly1305). See WithEncryptionRawKey<T>(T, byte[]) and
EncryptionAlgorithm.
public static T WithEncryptionRawKey<T>(this T _instance, byte[] key, EncryptionAlgorithm algorithm, KeySize keySize = KeySize.Aes256) where T : JsonSettings
Parameters
_instanceTkeybyte[]algorithmEncryptionAlgorithmkeySizeKeySize
Returns
- T
Type Parameters
T
WithEncryptionRawKey<T>(T, Func<byte[]>)
Attaches EncryptionModule using a raw AES key resolved on demand. See WithEncryptionRawKey<T>(T, byte[]).
public static T WithEncryptionRawKey<T>(this T _instance, Func<byte[]> key) where T : JsonSettings
Parameters
Returns
- T
Self
Type Parameters
T
WithEncryptionRawKey<T>(T, Func<T, byte[]>)
Attaches EncryptionModule using a raw AES key resolved from the instance on demand. See WithEncryptionRawKey<T>(T, byte[]).
public static T WithEncryptionRawKey<T>(this T _instance, Func<T, byte[]> key) where T : JsonSettings
Parameters
Returns
- T
Self
Type Parameters
T
WithEncryption<T>(T, byte[])
Attaches EncryptionModule using a binary password. The bytes are stretched into a key with the same PBKDF2 construction as a text password, so this is salted and iterated - but it is a DIFFERENT credential from the text password whose UTF-8 encoding equals these bytes. To use bytes verbatim as the key instead, see WithEncryptionRawKey<T>(T, byte[]).
public static T WithEncryption<T>(this T _instance, byte[] password) where T : JsonSettings
Parameters
_instanceTpasswordbyte[]The binary password.
Returns
- T
Self
Type Parameters
T
WithEncryption<T>(T, byte[], EncryptionAlgorithm, KeySize)
Attaches an EncryptionModule using a binary password with
algorithm and keySize instead of the default
AES-256-CBC. See WithEncryption<T>(T, byte[]) and EncryptionAlgorithm.
public static T WithEncryption<T>(this T _instance, byte[] password, EncryptionAlgorithm algorithm, KeySize keySize = KeySize.Aes256) where T : JsonSettings
Parameters
_instanceTpasswordbyte[]algorithmEncryptionAlgorithmkeySizeKeySize
Returns
- T
Type Parameters
T
WithEncryption<T>(T, Func<byte[]>)
Attaches EncryptionModule using a binary password resolved on demand. See WithEncryption<T>(T, byte[]).
public static T WithEncryption<T>(this T _instance, Func<byte[]> password) where T : JsonSettings
Parameters
Returns
- T
Self
Type Parameters
T
WithEncryption<T>(T, Func<SecureString>)
Attaches an EncryptionModule (AES-256-CBC by default).
public static T WithEncryption<T>(this T _instance, Func<SecureString> password) where T : JsonSettings
Parameters
_instanceTpasswordFunc<SecureString>A fetcher/getter/generator/action-pointer to the password source
Returns
- T
Self
Type Parameters
T
WithEncryption<T>(T, Func<string>)
Attaches an EncryptionModule (AES-256-CBC by default).
public static T WithEncryption<T>(this T _instance, Func<string> password) where T : JsonSettings
Parameters
Returns
- T
Self
Type Parameters
T
WithEncryption<T>(T, Func<T, byte[]>)
Attaches EncryptionModule using a binary password resolved from the instance on demand. See WithEncryption<T>(T, byte[]).
public static T WithEncryption<T>(this T _instance, Func<T, byte[]> password) where T : JsonSettings
Parameters
Returns
- T
Self
Type Parameters
T
WithEncryption<T>(T, Func<T, SecureString>)
Attaches an EncryptionModule (AES-256-CBC by default).
public static T WithEncryption<T>(this T _instance, Func<T, SecureString> password) where T : JsonSettings
Parameters
_instanceTpasswordFunc<T, SecureString>A fetcher/getter/generator/action-pointer to the password source
Returns
- T
Self
Type Parameters
T
WithEncryption<T>(T, Func<T, string>)
Attaches an EncryptionModule (AES-256-CBC by default).
public static T WithEncryption<T>(this T _instance, Func<T, string> password) where T : JsonSettings
Parameters
_instanceTpasswordFunc<T, string>A fetcher/getter/generator/action-pointer to the password source
Returns
- T
Self
Type Parameters
T
WithEncryption<T>(T, SecureString)
Attaches an EncryptionModule (AES-256-CBC by default).
public static T WithEncryption<T>(this T _instance, SecureString password) where T : JsonSettings
Parameters
_instanceTpasswordSecureStringA fetcher/getter/generator/action-pointer to the password source
Returns
- T
Self
Type Parameters
T
WithEncryption<T>(T, string)
Attaches an EncryptionModule (AES-256-CBC by default).
public static T WithEncryption<T>(this T _instance, string password) where T : JsonSettings
Parameters
_instanceTpasswordstringA fetcher/getter/generator/action-pointer to the password source
Returns
- T
Self
Type Parameters
T
WithEncryption<T>(T, string, EncryptionAlgorithm, KeySize)
Attaches an EncryptionModule using algorithm and
keySize instead of the default AES-256-CBC. See
EncryptionAlgorithm for the available algorithms and their availability per
target framework.
public static T WithEncryption<T>(this T _instance, string password, EncryptionAlgorithm algorithm, KeySize keySize = KeySize.Aes256) where T : JsonSettings
Parameters
_instanceTpasswordstringThe password source.
algorithmEncryptionAlgorithmThe symmetric algorithm to use.
keySizeKeySizeThe AES key size (ignored by ChaCha20-Poly1305). Defaults to 256-bit.
Returns
- T
Self
Type Parameters
T
WithFileName<T>(T, FileInfo)
public static T WithFileName<T>(this T _instance, FileInfo filename) where T : JsonSettings
Parameters
_instanceTfilenameFileInfo
Returns
- T
Type Parameters
T
WithFileName<T>(T, string)
public static T WithFileName<T>(this T _instance, string filename) where T : JsonSettings
Parameters
_instanceTfilenamestring
Returns
- T
Type Parameters
T
WithModule<T>(T, Module)
Load custom made module.
public static T WithModule<T>(this T _instance, Module module) where T : JsonSettings
Parameters
_instanceTSelf
moduleModuleThe module instance
Returns
- T
Self
Type Parameters
T
WithModule<T, TMod>(T, params object[])
Loads a freshly constructed module with the following arguments.
public static T WithModule<T, TMod>(this T _instance, params object[] args) where T : JsonSettings where TMod : Module
Parameters
_instanceTSelf
argsobject[]The arguments to fit into a constructor.
Returns
- T
Self
Type Parameters
TTMod
WithRecovery<T>(T, RecoveryAction)
RecoveryModule used to enforce a fail-safe recovery and take RecoveryAction when the json parsing fails.
public static T WithRecovery<T>(this T _instance, RecoveryAction action) where T : JsonSettings
Parameters
_instanceTactionRecoveryAction
Returns
- T
Type Parameters
T
WithVersioning<T>(T, VersioningResultAction, VersioningPolicyHandler?)
VersioningModule used to enforce a policy and take VersioningResultAction when the policy
detects an invalid version. A policy is a VersioningPolicyHandler comparer between two Version.
This overload uses EnforcedVersionAttribute to resolve the default attribute.
public static T WithVersioning<T>(this T _instance, VersioningResultAction invalidAction, VersioningPolicyHandler? policy = null) where T : JsonSettings, IVersionable
Parameters
_instanceTthe instance being configured
invalidActionVersioningResultActionThe action to take when the
policyreturns falsepolicyVersioningPolicyHandlerThe version comparison policy, return true when version is OK.
Returns
- T
Type Parameters
TThe settings type inheriting IVersionable
WithVersioning<T>(T, string, VersioningResultAction, VersioningPolicyHandler?)
VersioningModule used to enforce a policy and take VersioningResultAction when the policy detects an invalid version. A policy is a VersioningPolicyHandler comparer between two Version.
public static T WithVersioning<T>(this T _instance, string expectedVersion, VersioningResultAction invalidAction, VersioningPolicyHandler? policy = null) where T : JsonSettings, IVersionable
Parameters
_instanceTthe instance being configured
expectedVersionstringThe expected version based on given
policyinvalidActionVersioningResultActionThe action to take when the
policyreturns falsepolicyVersioningPolicyHandlerThe version comparison policy, return true when version is OK.
Returns
- T
Type Parameters
TThe settings type inheriting IVersionable
WithVersioning<T>(T, Version, VersioningResultAction, VersioningPolicyHandler?)
VersioningModule used to enforce a policy and take VersioningResultAction when the policy detects an invalid version. A policy is a VersioningPolicyHandler comparer between two Version.
public static T WithVersioning<T>(this T _instance, Version expectedVersion, VersioningResultAction invalidAction, VersioningPolicyHandler? policy = null) where T : JsonSettings, IVersionable
Parameters
_instanceTthe instance being configured
expectedVersionVersionThe expected version based on given
policyinvalidActionVersioningResultActionThe action to take when the
policyreturns falsepolicyVersioningPolicyHandlerThe version comparison policy, return true when version is OK.
Returns
- T
Type Parameters
TThe settings type inheriting IVersionable