Interface IUpdateConstraintFactory

The factory for the update constraint types.

Namespace: PushTechnology.ClientInterface.Client.Features
Assembly: Diffusion.Client.dll
Syntax
public interface IUpdateConstraintFactory
Remarks

An instance can be obtained by calling UpdateConstraints.

Properties

JSONValue

Gets the constraint that partially matches the current topic value.

Declaration
IPartialJSON JSONValue { get; }
Property Value
Type Description
IPartialJSON

The constraint.

Remarks

The topic must be a JSON topic (or a TIME_SERIES topic with a json event type). The IPartialJSON partially describes the structure of a IJSON value. The With<TValue>(String, UpdateConstraintOperator, TValue) or Without(String) methods must be used to fully qualify the constraint.

The constraint is unsatisfied if no topic is present at the path.

NoTopic

Gets the constraint requiring the path to have no topic.

Declaration
IUpdateConstraint NoTopic { get; }
Property Value
Type Description
IUpdateConstraint

The constraint.

Remarks

This is useful when setting the first value of a topic being added using AddAndSetAsync<TValue>(String, ITopicSpecification, TValue, IUpdateConstraint) without changing the value if the topic already exists. This constraint is unsatisfied if a topic is present at the path.

NoValue

Gets the constraint requiring the topic to have no value.

Declaration
IUpdateConstraint NoValue { get; }
Property Value
Type Description
IUpdateConstraint

The constraint.

Remarks

This constraint is unsatisfied if no topic is present at the path.

Methods

Locked(ISessionLock)

Creates a constraint requiring a lock to be held by the session.

Declaration
IUpdateConstraint Locked(ISessionLock sessionLock)
Parameters
Type Name Description
ISessionLock sessionLock

The session lock.

Returns
Type Description
IUpdateConstraint

The new update constraint.

Remarks

This can be used to coordinate operations between multiple sessions.

Value<TValue>(TValue)

Creates a constraint requiring the current value of a topic to exactly match the supplied value.

Declaration
IUpdateConstraint Value<TValue>(TValue value)
Parameters
Type Name Description
TValue value

The value.

Returns
Type Description
IUpdateConstraint

The new update constraint.

Type Parameters
Name Description
TValue

The value type.

Remarks

This is exactly equivalent to calling Value<TValue>(UpdateConstraintOperator, TValue) specifying the IS operator.

Value<TValue>(UpdateConstraintOperator, TValue)

Creates a constraint comparing the current value of a topic to a supplied value.

Declaration
IUpdateConstraint Value<TValue>(UpdateConstraintOperator updateConstraintOperator, TValue value)
Parameters
Type Name Description
UpdateConstraintOperator updateConstraintOperator

The operator that determines the type of comparison.

TValue value

The value.

Returns
Type Description
IUpdateConstraint

The constraint.

Type Parameters
Name Description
TValue

The value type.

Remarks

If a System.String value is supplied and the operator is EQ or NE, the string representation of the topic will be compared to the supplied value. This can only be used with primitive topic types (or TIME_SERIES topics with a primitive event type). Other operators (other than IS) are not permitted with string values.

If a number value is supplied (System.Int32, System.Int64 or System.Double) the value will be compared with the number value of the topic. This will work with STRING, INT64 or DOUBLE topics (or TIME_SERIES topics with a primitive event type) only. STRING topics can only be compared if they contain a value that can be parsed as a number. If the value of a STRING topic cannot be parsed as a number, or the topic is of any other non-number type the constraint will be unsatisfied. Any of the operators (other than IS) can be used with such number comparisons. Decimal numbers can be compared with integral numbers so 1 is equal to 1.0, "1", or "1.0".

If the IS operator is specified the specified value will be compared to the topic value for strict binary equality. The value type can be any value type supported by IDataTypes (System.Int32 is allowed and is treated as a System.Int64) or any IBytes value and can be used to compare against any topic type.

When a STRING, INT64 or DOUBLE topic is updated to a null value, the topic is set to have no value. Use the NoValue constraint to check if the topic has no value.

This constraint is unsatisfied if no topic is present at the path.

Since 6.10.

Back to top