Spotfire.Dxp.Framework.DocumentModel RuntimeProperty T
Namespace: Spotfire.Dxp.Framework.DocumentModel
Assembly: Spotfire.Dxp.Framework (in Spotfire.Dxp.Framework.dll) Version: 18.10.8513.5432 (18.10.8513.5432)
- T
- The Type of the values held by the runtime property. This must be an immutable type.
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 PropertyComputer T 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.