MDrivenWiki
Log in

Difference between revisions of "OCLOperators RootObject"

From MDrivenWiki
(Created page with "selfVM.RootObject gives access to the object rooting a viewmodel instance. This is readonly and you can use it like this: selfVM.RootObject->safeCast(Thing).SomeString:='a ne...")
 
 
Line 2: Line 2:
  
 
selfVM.RootObject->safeCast(Thing).SomeString:='a new value'
 
selfVM.RootObject->safeCast(Thing).SomeString:='a new value'
 +
 +
? Why is the selfVM.RootObject not typed and require a cast to be used with the real root? Because OCL is a statically typed language and selfVM is context sensitive in the meaning it is available in all viewmodels - and there is no 1 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.

Latest revision as of 10:58, 29 May 2019

selfVM.RootObject gives access to the object rooting a viewmodel instance. This is readonly and you can use it like this:

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

? Why is the selfVM.RootObject not typed and require a cast to be used with the real root? Because OCL is a statically typed language and selfVM is context sensitive in the meaning it is available in all viewmodels - and there is no 1 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.