Interface IRecordV2DataType
Record-based data type.
Inherited Members
Namespace: PushTechnology.ClientInterface.Data.Record
Assembly: Diffusion.Client.dll
Syntax
public interface IRecordV2DataType : IDataType<IRecordV2>, IDataType
Remarks
This provides the ability to handle data in Diffusion proprietary 'record' format. This format allows string data to be organized into 'records' which in turn are made up of 'fields'. Each field is a string but may be handled as either an integer or a decimal field if required.
The data can either be free format or constrained by a ISchema.
In free format mode, no schema is associated with the data and the data will contain zero or more records, each comprising zero or more fields. In this mode the meaning of each field is entirely up to the application and no validation will be performed by Diffusion, either in the client library, or at the server. To write free format records, a IRecordV2Builder can be used to create a IRecordV2 object. Such a builder may be created using the CreateValueBuilder() method.
When using a ISchema then the permitted records and fields are defined by the schema. The schema names the records and the fields within them and provides a mechanism for direct access to the fields. The schema is also used to validate the data to ensure it complies with the schema definition.
In schema mode, data can be created and updated using a IMutableRecordModel which allows records and fields to be conveniently set and updated by name. A base model can be created from a schema using the CreateMutableModel() method. The model can at any time be used to create a new IRecordV2 object. A consumer of a IRecordV2 value can read it as a IRecordModel by simply using the AsModel(ISchema) method to produce an immutable representation of the data. When creating the data using a IMutableRecordModel then the model ensures that the data is valid and therefore there is no need for the server or the consuming client to validate the data.
Schemas can be parsed from JSON strings or more simply using a ISchemaBuilder obtained using the CreateSchemaBuilder() method. A schema can be bound to a IRecordV2 data type instance using the method WithSchema(ISchema). This method will return a new IRecordV2DataType instance with the schema bound to it for validation.
A IRecordV2 object can only be validated within the context of a ISchema. For this reason if the Validate(Object) method is called on a dataType that has no bound schema, it will always succeed.
Implemented in Version 6.0.
Properties
BinaryDeltaType
Returns support for binary deltas.
Declaration
IDeltaType<IRecordV2, IBinaryDelta> BinaryDeltaType { get; }
Property Value
Type | Description |
---|---|
IDeltaType<IRecordV2, IBinaryDelta> |
Methods
CreateSchemaBuilder()
Returns a new ISchemaBuilder.
Declaration
ISchemaBuilder CreateSchemaBuilder()
Returns
Type | Description |
---|---|
ISchemaBuilder | The new ISchemaBuilder. |
CreateValueBuilder()
Returns a new IRecordV2Builder.
Declaration
IRecordV2Builder CreateValueBuilder()
Returns
Type | Description |
---|---|
IRecordV2Builder | The new IRecordV2Builder. |
Remarks
Such a builder may be used to generate free format IRecordV2 format value that is not constrained by a ISchema.
ParseSchema(String)
Parses a schema from a JSON string.
Declaration
ISchema ParseSchema(string json)
Parameters
Type | Name | Description |
---|---|---|
String | json | The JSON string containing a schema definition. |
Returns
Type | Description |
---|---|
ISchema | The schema object. |
WithSchema(ISchema)
Binds a specific schema to a IRecordV2DataType instance.
Declaration
IRecordV2DataType WithSchema(ISchema schema)
Parameters
Type | Name | Description |
---|---|---|
ISchema | schema | The schema to bind to the data type. |
Returns
Type | Description |
---|---|
IRecordV2DataType | The new IRecordV2DataType instance bound to a specific schema. |