Interface IMutableRecordModel

The mutable data model of IRecordV2 data based upon a ISchema.

Inherited Members
IRecordModel.Get(String, Int32, String, Int32)
IRecordModel.Get(String)
IRecordModel.RecordCount(String)
IRecordModel.FieldCount(String, Int32, String)
IRecordModel.AsValue()
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
System.String recordName

The name of the record.

System.Int32 recordIndex

The index identifying the occurrence of the record.

System.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
System.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
System.String recordName

The name of the record.

System.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
System.String recordName

The name of the record.

System.Int32 recordIndex

The record index.

System.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
System.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
System.String recordName

The name of the record containing the field.

System.Int32 recordIndex

The index of the record containing the field.

System.String fieldName

The name of the field.

System.Int32 fieldIndex

The index of the field.

System.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
System.String key

The field key.

System.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.

Back to top