Skip navigation.

Reactor - Using the field tag to to alias duplicate columns

|

It is mentioned in the Reactor docs that the <field> tag can be used within your object definitions to pretty up ugly column names such as txt_lastname or strCity, but it should also be noted it can be used to diferentiate between two tables which both have fields with the same name.

for example, if all my tables have a modified date timestamp

<object name="User">
<field name="ModifiedDate" alias="UserModifiedDate" />
      <hasMany name="Task">
            <relate from="Taskid" to="Taskid" />
      </hasMany>
</object>
<object name="Task">
<field name="ModifiedDate" alias="TaskModifiedDate" />
<hasOne name="User">
            <relate from="UserId" to="UserId" />
      </hasOne>
</object>

Then, when I am doing a join later, I can reference the modified dates correctly.