Interface IMutableRecordModel
Inherited Members
Namespace: PushTechnology.ClientInterface.Data.Record.Model
Assembly: Diffusion.Client.dll
Syntax
public interface IMutableRecordModel : IRecordModel
Remarks
An initial version of such a model can be created from a schema using the CreateMutableModel() method. A model created in this way will have all mandatory fields set to default values.
The model may then be updated as required and then at any time a IRecordV2 object can be generated from the current state using the AsValue() method. The IRecordV2 object may then be used to update a topic.
When values for integer or decimal type fields are supplied the values are validated and normalized.
All mutator methods return the model so that calls can be chained.
Implemented in Version 6.0.
Methods
Add(String, Int32, String[])
Adds new values to the end of a variable length field list.
Declaration
IMutableRecordModel Add(string recordName, int recordIndex, params string[] values)
Parameters
Type | Name | Description |
---|---|---|
String | recordName | The name of the record. |
Int32 | recordIndex | The index identifying the occurrence of the record. |
String[] | values | The values to add. |
Returns
Type | Description |
---|---|
IMutableRecordModel | The current model instance. |
Remarks
This can only be used for a variable multiplicity field which can only be the last field in a record and therefore the field does not need to be named.
Add(String[])
Adds new values to the end of a variable length field list.
Declaration
IMutableRecordModel Add(params string[] values)
Parameters
Type | Name | Description |
---|---|---|
String[] | values | The values. |
Returns
Type | Description |
---|---|
IMutableRecordModel | The current model instance. |
Remarks
This is a convenience method for adding to the end of the last record and is therefore useful when there is only one record type.
AddRecord()
Adds a new initialized record occurrence to the end of a variable multiplicity record list.
Declaration
IMutableRecordModel AddRecord()
Returns
Type | Description |
---|---|
IMutableRecordModel | The current model instance. |
Remarks
As the only variable multiplicity record can be the last one there is no need to name the record. This method will add to the list of occurrences of the last defined record. The record will be initialized with default values appropriate to the schema definition and may then have individual field items set separately.
ClearVariableFields(String, Int32)
Remove all optional instances of a variable multiplicity field.
Declaration
IMutableRecordModel ClearVariableFields(string recordName, int recordIndex)
Parameters
Type | Name | Description |
---|---|---|
String | recordName | The name of the record. |
Int32 | recordIndex | The index of the record. |
Returns
Type | Description |
---|---|
IMutableRecordModel | The current model instance. |
Remarks
As a variable repeating field can only be the last or only field within a record then the field name does not need to be specified.
This will only remove field occurrences down to the minimum number of occurrences specified by the schema.
If the last or only field within the record is not defined as variable multiplicity, this would have no effect.
ClearVariableRecords()
Removes all optional instances of a variable multiplicity record.
Declaration
IMutableRecordModel ClearVariableRecords()
Returns
Type | Description |
---|---|
IMutableRecordModel | The current model instance. |
Remarks
As a variable repeating record can only be the last or only record then the record name does not need to be specified.
This will only remove record occurrences down to the minimum number of occurrences specified by the schema.
If the last or only record is not defined as variable multiplicity, this would have no effect.
RemoveField(String, Int32, Int32)
Removes the specified occurrence of a variable multiplicity field.
Declaration
IMutableRecordModel RemoveField(string recordName, int recordIndex, int fieldIndex)
Parameters
Type | Name | Description |
---|---|---|
String | recordName | The name of the record. |
Int32 | recordIndex | The record index. |
Int32 | fieldIndex | The index of the field to remove. |
Returns
Type | Description |
---|---|
IMutableRecordModel | The current model instance. |
Remarks
A variable multiplicity field must be the last or only field within a record and therefore the field name is not required.
RemoveRecord(Int32)
Removes the specified occurrence of a variable multiplicity record.
Declaration
IMutableRecordModel RemoveRecord(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the record to remove. |
Returns
Type | Description |
---|---|
IMutableRecordModel | The current model instance. |
Remarks
A variable multiplicity record must be the last or only record within a schema and therefore the record name is not required.
Set(String, Int32, String, Int32, String)
Sets a specified field value.
Declaration
IMutableRecordModel Set(string recordName, int recordIndex, string fieldName, int fieldIndex, string value)
Parameters
Type | Name | Description |
---|---|---|
String | recordName | The name of the record containing the field. |
Int32 | recordIndex | The index of the record containing the field. |
String | fieldName | The name of the field. |
Int32 | fieldIndex | The index of the field. |
String | value | The new value. |
Returns
Type | Description |
---|---|
IMutableRecordModel | The current model instance. |
Set(String, String)
Sets a specified field value.
Declaration
IMutableRecordModel Set(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
String | key | The field key. |
String | value | The field value. |
Returns
Type | Description |
---|---|
IMutableRecordModel | The current model instance. |
Remarks
This allows an item to be addressed using a key of the form
"RecordName(RecordIndex).FieldName(FieldIndex)"
.
Indexes may be omitted in which case 0 is assumed. The record
part may also be omitted in which case the first occurrence
of the first record is assumed.