Interface IRecordModel

IRecordV2 data model.

Namespace: PushTechnology.ClientInterface.Data.Record.Model
Assembly: Diffusion.Client.dll
Syntax
public interface IRecordModel
Remarks

A read only model can be created from any IRecordV2 object using the AsModel(ISchema) method. The model then provides direct access to the fields within the data. Fields may be accessed either by explicitly specifying the record and field occurrence or by specifying a key of the form: "RecordName(RecordIndex).FieldName(fieldIndex)".

Indexes start from 0 and if omitted then 0 is assumed. The record name may also be omitted, in which case the first record definition will be used. This form of addressing is useful when there is only one record definition.

So valid keys would be:

Key Description
Address(4).AddressLine(3) The 4th AddressLine occurrence within the 5th Address record.
Address.Name The first (or only) Name field within the first (or only) Address record.
AddressLine(1) The 2nd AddressLine field within the first (or only) record.
Name The first (or only) Name field within the first (or only) record.

The RecordCount(String) and FieldCount(String, Int32, String) methods are useful for determining the actual number of occurrences of variable multiplicity items.

Implemented in Version 6.0.

Methods

AsValue()

Creates an immutable IRecordV2 object generated from the model.

Declaration
IRecordV2 AsValue()
Returns
Type Description
IRecordV2

The new immutable IRecordV2 object.

FieldCount(String, Int32, String)

Returns the actual number of occurrences of a named field within a specified record occurrences.

Declaration
int FieldCount(string recordName, int recordIndex, string fieldName)
Parameters
Type Name Description
System.String recordName

The record name.

System.Int32 recordIndex

The record index.

System.String fieldName

The field name.

Returns
Type Description
System.Int32

The actual number of occurrences of the field.

Remarks

For all but variable fields this simply returns the schema defined number of occurrences of the field.

Get(String)

Returns a field value.

Declaration
string Get(string key)
Parameters
Type Name Description
System.String key

The field key.

Returns
Type Description
System.String

The field value.

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.

Get(String, Int32, String, Int32)

Returns a field value.

Declaration
string Get(string recordName, int recordIndex, string fieldName, int fieldIndex)
Parameters
Type Name Description
System.String recordName

The name of the record.

System.Int32 recordIndex

The index of the record.

System.String fieldName

The name of the field.

System.Int32 fieldIndex

The index of the field.

Returns
Type Description
System.String

The field value.

RecordCount(String)

Returns the actual number of occurrences of a named record.

Declaration
int RecordCount(string recordName)
Parameters
Type Name Description
System.String recordName

The record name.

Returns
Type Description
System.Int32

The actual number of occurrences of the record.

Remarks

If the record is not variable, this is the same as the defined number of occurrences in the schema.

Back to top