Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Use the ClassBuilder.Add.CalculatedProperty(...) or one of the overloads to create a new calculated property.

See Metadata Delegate Expressions for many examples of creating calculated properties.

Value-

...

This setting applies to all properties (persistent and calculated) but it is especially useful for calculated properties.

An application can indicate when Quino should recalculate the value for a property.

  • Default: For persistent properties, the default is Cached; for calculated properties, it's Volatile.

  • Cached: The value is cached on first retrieval. It is only refreshed when the object is reloaded.

  • Volatile: The value is recalculated on each retrieval.

If an application has calculated properties that are expensive to calculate but whose value doesn't often change, it can change the value-generation frequency to Cached in order to speed up display in the UI or reports.

A product can put as much logic/work as it needs into a calculated property. In the next case, we use the ValueGenerationFrequency to cache the value.

...

API

Methode

Beschreibung

Value<Person, string>((person) => "Statischer Wert")

Berechnet einen Wert anhand des Objektes. Die Funktion wird erneut aufgerufen beim Zugriff auf die Eigenschaft.

Value<Person, PersonService, string>((service, person) => service.CalculateValue(person))

Berechnet den Wert der Property anhand eines Services.

Value<PersonService>((service) => service.CalculateValue)

Berechnet den Wert direkt über den mitgegebenen Delegate. Die Signatur des Delegate muss als ersten Parameter ein IDataObject oder eine abgeleitete Variante übernehmen.

Da die Werte bei jedem Zugriff neu berechnet werden sollte die Berechnung keine zu zeitintensiven Operationen anstossen.