Click or drag to resize

AzureTableSettingsPut Method

Puts a value into the settings table.

Namespace: Orthogonal.NSettings.AzureTable
Assembly: Orthogonal.NSettings.AzureTable (in Orthogonal.NSettings.AzureTable.dll) Version: 3.0.5
Syntax
C#
public Task Put(
	Object? appKey,
	Object itemKey,
	Object? value
)

Parameters

appKey  Object
  • An object that optionally provides the application primary key part of the two-part key for a setting. The object value is internally converted to a key string by calling its ToString method. A null value is allowed which is suitable for settings which are not associated with any specific application or perhaps shared between applications.
  • An application primary key can be used to partition settings into groups so they can be more easily managed, such as listing or deleting them all at the application key level.
  • The application key is case sensitive.
  • Hint: It is good coding practise to specify the application key as an enumerated value or a global string constant.
itemKey  Object
  • An object that provides the item secondary key part of the two-part key for a setting. The object value is internally converted to a key string by calling its ToString method.
  • The item key is case sensitive.
  • Hint: It is good coding practise to specify the item key using the C# or Visual Basic nameof operator.
value  Object

The object value to put in the setting. The value may be null.

The object providing the setting's non-null value must be of a Type that is capable of being two-way serialized as a culture invariant string. Most .NET primitive structs and classes (int, long, Guid, etc) have type converters implicitly assigned to them to allow suitable serialization. The byte[] and string[] types do not have suitable default converters, but they are treated as special cases and converted correctly. Custom types will require a custom type converter to allow serialization. See the CustomClass in the test project for an example of a custom converter.

An alternative to creating a custom type converter is to encode a problematic object to a string of XML or JSON using the appropriate .NET utility classes and put the encoded string into the setting.

Azure Table documentation states that the size limit of a property value is 64K. It's unclear in what format the string value is stored, but if it's encoded as 2-byte Unicode then the limit for the serialized string value would be about 32K. Since application settings are typically small values, the limit is not epxected to be a problem in practical usage scenarios.

Return Value

Task
A Task that can be used to wait for the completion of asynchronous processing. There is no return value.
Exceptions
ExceptionCondition
NotSupportedException

The value's Type is not capable of two-way serialization as a culture invariant string. Values can only be round-tripped as a setting if their Type is assigned a TypeConverter capable of converting the value to and from a string representation. Most .NET primitive structs and classes have implicit suitable converters, but user-defined classes will need a custom converter.

ArgumentException

Thrown in the following conditions for a non-null value parameter:

1. The value is a string array with elements containing all of the reserved characters that can be used as delimiters in the serialized string. The value cannot be unambiguously serialized.

2. The value is a string array with an element equal to the special indicator string "__null__". The value cannot be unambiguously serialized.

See Also