OCLOperators RootObject
This page was created by Hans.karlsen@mdriven.net on 2019-05-29. Last edited by Edgar on 2025-01-20.

selfVM.RootObject gives access to the object rooting a ViewModel instance. This is read-only and you can use it like this:

selfVM.RootObject->safeCast(Thing).SomeString:='a new value'

Why is the selfVM.RootObject not typed but requires a cast to be used with the real root? Because OCL is a statically typed language and selfVM is context sensitive - meaning it is available in all ViewModels - there is no one answer to what type the RootObject should have. If you are in the context of a ViewModel, you will however know what type it has and can safely cast.