Class WriteOperationCollection
Namespace: Oracle.NoSQL.SDK
Assembly: Oracle.NoSQL.SDK.dll
Syntax
public class WriteOperationCollection : Object
Remarks
This class represents the operations to be performed as a list of
instances implementing IWriteOperation interface,
consisting of the following classes:
You do not need to instantiate the above classes to add operations
to the collection, instead use methods of
WriteOperationCollection. However the instances of
the classes above will be available for inspection if you iterate
through the collection using foreach
loop, in which case you
can downcast IWriteOperation to one of the classes
listed above.
Note that the methods of WriteOperationCollection are divided into two groups: those that take table name parameter and those that don't. Use as following:
- If this instance is passed to WriteManyAsync(WriteOperationCollection, WriteManyOptions, CancellationToken), use the methods that take table name. Failure to provide table name for any operation will result in error.
- If this instance is passed to WriteManyAsync(String, WriteOperationCollection, WriteManyOptions, CancellationToken), table name is already passed as a parameter to this method and thus must not be passed to WriteOperationCollection methods. Providing table name for any operation will result in error.
The methods of WriteOperationCollection return the instance itself so that their calls can be chained as shown in the example. Validation is performed on the parameters before the operation is added to the collection.
Note that some of the methods of WriteOperationCollection take PutOptions or DeleteOptions parameters as the options for the operation. Properties such as Compartment, Timeout, Durability, Namespace, Compartment, Timeout, Durability and Namespace are ignored as they are not relevant for a single operation in the collection. Instead, use Compartment and Timeout.
Examples
Populating an instance of WriteOperationCollection without providing table name.var woc = new WriteOperationCollection()
.AddPut(row1, true)
.AddPutIfVersion(row2, version2)
.AddPut(row3, new PutOptions
{
TTL = TimeToLive.OfDays(1)
})
.AddDelete(primaryKey3, true)
.AddDeleteIfVersion(primaryKey4, version4, true));
Populating an instance of WriteOperationCollection
with providing table names.
var woc = new WriteOperationCollection()
.AddPut("myTable", row1, true)
.AddPutIfVersion("myTable.childTable1", row2, version2)
.AddDelete("myTable.childTable2", primaryKey3, true);
Constructors
Name | Description |
---|---|
WriteOperationCollection() | Initializes a new empty instance of WriteOperationCollection with default initial capacity. |
WriteOperationCollection(Int32) | Initializes a new empty instance of WriteOperationCollection with specified initial capacity. |
Properties
Name | Description |
---|---|
Count | Gets the number of operations in the collection. |