Class MapValue
Implements
Inherited Members
Namespace: Oracle.NoSQL.SDK
Assembly: Oracle.NoSQL.SDK.dll
Syntax
public class MapValue : FieldValue
Remarks
This class is used to represent values of NoSQL data types Map and Json. On input, for operations such as PutAsync(String, MapValue, PutOptions, CancellationToken) and WriteManyAsync this class also represents table rows. In addition, this class also represents primary key values used for operations such as GetAsync(String, MapValue, GetOptions, CancellationToken) and DeleteAsync(String, MapValue, DeleteOptions, CancellationToken). For the cases listed above the key ordering is not required. When the key ordering is required, e.g. for the results of operations such as GetAsync(String, MapValue, GetOptions, CancellationToken) and QueryAsync, RecordValue is used which represents the ordered dictionary and is a subclass of this class.
The instances of MapValue may have a nested structure as the values it represents may be of any subclass of FieldValue including complex types such as ArrayValue, MapValue and RecordValue. On input, e.g. when inserting a row via PutAsync(String, MapValue, PutOptions, CancellationToken), the mapping between the keys of MapValue instance and table fields is case-insensitive. The same is true for keys/fields inside the values of data types Map and Record. However, for fields inside a value of data type Json the mapping is case-sensitive.
This class supports all the functionality of
IDictionary<TKey,TValue> interface, including
enumeration with foreach
loop.
Examples
Creating an instance of MapValue to represent a row with fields "id" and "info" of data types Long and Json respectively.var row = new MapValue
{
["id"] = 1000,
["info"] = new MapValue
{
["myArray"] = new ArrayValue { 1, 2, 3, 4, 5 },
["myObject"] = new MapValue
{
["myString"] = "abc",
["myBinary"] = Convert.FromBase64String("xyz")
}
}
};
Constructors
Name | Description |
---|---|
MapValue() | Initializes a new instance of MapValue that is empty and has the default initial capacity. |
MapValue(IEnumerable<KeyValuePair<String, FieldValue>>) | Initializes a new instance of MapValue that contains elements from the specified collection of key-value pairs. |
MapValue(Int32) | Initializes a new instance of MapValue that is empty and has the specified initial capacity. |
Properties
Name | Description |
---|---|
Count | Gets the number of key/value pairs in the dictionary represented by this MapValue instance. |
DbType | Gets DbType of this instance which represents the type of this value. |
Item[String] | Gets or sets the value associated with the specified key. |
Keys | Gets the collection containing the keys in the dictionary represented by this MapValue instance. |
Values | Gets the collection containing the values in the dictionary represented by this MapValue instance. |
Methods
Name | Description |
---|---|
Add(String, FieldValue) | Adds the specified key and value to the dictionary represented by this instance. |
Clear() | Remove all keys and values from the dictionary represented by this instance. |
ContainsKey(String) | Determines whether the specified key exists in the dictionary represented by this instance. |
Remove(String) | Removes the value with the specified key from the dictionary represented by this instance. |
SerializeAsJson(Utf8JsonWriter, JsonOutputOptions) | Writes JSON representation of the value to the stream represented by Utf8JsonWriter. |
TryGetValue(String, out FieldValue) | Gets the value associated with the specified key. |