Search code examples
codefluent

use _trackXXX columns in the business object model


Is there any way to view the persistence tracking fields (_trackLastWriteTime) as properties in my BOM. I've seen a similar question in your website forums, but due to the updates you made to it, answers are lacking of "code" sections, so they are useless. Thanks again! Josep.


Solution

  • You can just declare the following properties to the entity:

    <cf:property name="LastWriteTime" typeName="datetime" persistenceName="_trackLastWriteTime" readOnLoad="true" readOnSave="true" persistent="false"/>
    <cf:property name="CreationTime" typeName="datetime" persistenceName="_trackCreationTime" readOnLoad="true" persistent="false" />
    <cf:property name="CreationUser" persistenceName="_trackCreationUser" readOnLoad="true" persistent="false" />
    <cf:property name="LastWriteUser" persistenceName="_trackLastWriteUser" readOnLoad="true" readOnSave="true" persistent="false" />
    
    • persistenceName should match the column name. This is the default column name but it could be different in your context. The property name is not important, only the persistence/column name.
    • persistent = false means the property is not persistent. This instructs the inference pipeline to not create a column corresponding to this property (because in fact it has already created that column).
    • readOnLoad = true and/or readOnSave = true means all layers will load and/or save this property, although it's been marked as non persistent.