RuntimePropertyT Class

Spotfire 14.2 API Reference
Holds a value that is lazily computed when accessed.
Inheritance Hierarchy

SystemObject
  Spotfire.Dxp.Framework.DocumentModelRuntimePropertyT

Namespace:  Spotfire.Dxp.Framework.DocumentModel
Assembly:  Spotfire.Dxp.Framework (in Spotfire.Dxp.Framework.dll) Version: 64.0.19329.3263 (64.0.19329.3263)
Syntax

C#
public sealed class RuntimeProperty<T>

Type Parameters

T
The Type of the values held by the runtime property. This must be an immutable type.

The RuntimePropertyT type exposes the following members.

Properties

  NameDescription
Public propertyValue
Returns the cached value of the property, or computes it if no cached value exists.
Top
Methods

  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Remarks

A RuntimeProperty should be used to compute values that functionally derived from the persistent state of a DocumentNode. When the value of a RuntimeProperty first is accessed, the value is computed by the StatelessPropertyComputerT delegate specified when the RuntimeProperty was created. The value is then cached so that subsequent accesses just return the already computed value. The cached value is kept until the Trigger computed by the StatelessDependencyDeclarer delegate fires.

A RuntimeProperty can be thought of as internally having two states, Invalid and Valid: Invalid This is the initial state. The RuntimeProperty has no value. The PropertyComputerT will be invoked to compute the value when the Value property is accessed and this will set the RuntimeProperty in state Valid. The RuntimeProperty does not generate any event when a property that it depends upon, as defined by the StatelessDependencyDeclarer, is changed. Valid The RuntimeProperty has a cached value which is returned when the Value property is accessed. When a property that the RuntimeProperty depends upon, as defined by the StatelessDependencyDeclarer, is changed, an event is generated, the value is dropped and the RuntimeProperty is set in state Invalid.

To use RuntimeProperties in a class deriving from DocumentNode, follow this pattern:

  • Declare a private readonly RuntimeProperty<TValue> field for each RuntimeProperty, where TValue is the type of the value in the RuntimeProperty. Note that this must be an immutable value.
  • Declare a method private void InitRuntimeProperties(out RuntimeProperty<TValue> myRtp, ...) that has one out parameter for each RuntimeProperty. This method shall call DocumentNode.CreateRuntimeProperty to create a RuntimeProperty object and assign the out parameters.
  • Call the InitRuntimeProperties at the end of each constructor, including the deserialization constructor.

Version Information

Supported in: 14.2, 14.1, 14.0, 12.5, 12.4, 12.3, 12.2, 12.1, 12.0, 11.8, 11.7, 11.6, 11.5, 11.4
See Also

Reference