Diffusion .NET Client Library  6.1.5
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
PushTechnology.ClientInterface.Data.Record.IRecordV2DataType Interface Reference

Record-based data type. More...

Inheritance diagram for PushTechnology.ClientInterface.Data.Record.IRecordV2DataType:
PushTechnology.ClientInterface.Data.IDataType< TValue > PushTechnology.ClientInterface.Data.IDataType

Public Member Functions

IRecordV2Builder CreateValueBuilder ()
 Returns a new IRecordV2Builder. More...
 
ISchemaBuilder CreateSchemaBuilder ()
 Returns a new ISchemaBuilder. More...
 
ISchema ParseSchema (string json)
 Parses a schema from a JSON string. More...
 
IRecordV2DataType WithSchema (ISchema schema)
 Binds a specific schema to a IRecordV2DataType instance. More...
 
- Public Member Functions inherited from PushTechnology.ClientInterface.Data.IDataType< TValue >
void WriteValue (TValue value, Stream outputStream)
 Serializes a value to binary. More...
 
new TValue ReadValue (byte[] input, int offset, int length)
 Parses a value from a binary data segment. More...
 
new TValue ReadValue (byte[] input)
 Parses a value from a binary. More...
 
new TValue ReadValue (IBytes bytes)
 Parses a value from binary. More...
 
void Validate (TValue value)
 Checks whether a value is valid. More...
 
IDeltaType< TValue, TDelta > DeltaType< TDelta > ()
 Returns a IDeltaType by type. More...
 
IBytes ToBytes (TValue value)
 Returns the serialized form of the given value as IBytes. More...
 
bool CanReadAs< TResult > ()
 Checks whether this data type is compatible with the given type parameter. More...
 
TResult ReadAs< TResult > (byte[] input, int offset, int length)
 Creates a value of a compatible type from a binary data segment. More...
 
TResult ReadAs< TResult > (byte[] input)
 Creates a value of a compatible type from a binary data segment. More...
 
TResult ReadAs< TResult > (IBytes bytes)
 Creates a value of a compatible type from a binary. More...
 
- Public Member Functions inherited from PushTechnology.ClientInterface.Data.IDataType
void WriteValue (object value, Stream outputStream)
 Serializes a value to binary. More...
 
void Validate (object value)
 Checks whether a value is valid. More...
 
IDeltaType DeltaType (string typeName)
 Returns a IDeltaType by name. More...
 
IDeltaType DeltaType (Type valueDeltaType)
 Returns a IDeltaType by type. More...
 
IBytes ToBytes (object value)
 Returns the serialized form of the given value as IBytes. More...
 
bool CanReadAs (Type resultType)
 Checks whether this data type is compatible with the given resultType . More...
 
object ReadAs (Type resultType, byte[] input, int offset, int length)
 Creates a value of a compatible type from a binary data segment. More...
 
object ReadAs (Type resultType, byte[] input)
 Creates a value of a compatible type from a binary data segment. More...
 
object ReadAs (Type resultType, IBytes bytes)
 Creates a value of a compatible type from binary. More...
 

Properties

IDeltaType< IRecordV2,
IBinaryDelta
BinaryDeltaType [get]
 Returns support for binary deltas. More...
 
- Properties inherited from PushTechnology.ClientInterface.Data.IDataType
string TypeName [get]
 Returns the external type identifier. More...
 

Detailed Description

Record-based data type.

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.

This format is compatible with Client.Topics.TopicType.RECORD topics and therefore can be used to migrate client applications from using such topics with minimal change to the application.

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 ISchema.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 IRecordV2.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 IDataType.Validate(object) method is called on a dataType that has no bound schema, it will always succeed.

Implemented in Version 6.0.

Member Function Documentation

ISchemaBuilder PushTechnology.ClientInterface.Data.Record.IRecordV2DataType.CreateSchemaBuilder ( )

Returns a new ISchemaBuilder.

Returns
The new ISchemaBuilder.
IRecordV2Builder PushTechnology.ClientInterface.Data.Record.IRecordV2DataType.CreateValueBuilder ( )

Returns a new IRecordV2Builder.

Such a builder may be used to generate free format IRecordV2 format value that is not constrained by a ISchema.

Returns
The new IRecordV2Builder.
ISchema PushTechnology.ClientInterface.Data.Record.IRecordV2DataType.ParseSchema ( string  json)

Parses a schema from a JSON string.

Parameters
jsonThe json string containing a schema definition.
Returns
The schema object.
IRecordV2DataType PushTechnology.ClientInterface.Data.Record.IRecordV2DataType.WithSchema ( ISchema  schema)

Binds a specific schema to a IRecordV2DataType instance.

Parameters
schemaThe schema to bind to the data type.
Returns
The new IRecordV2DataType instance bound to a specific schema.

Property Documentation

IDeltaType<IRecordV2, IBinaryDelta> PushTechnology.ClientInterface.Data.Record.IRecordV2DataType.BinaryDeltaType
get

Returns support for binary deltas.


The documentation for this interface was generated from the following file: