Within the XPO ORM wizard, I set a data field to be readonly as I never want it to be updated by XPO, but want to the view data using XPO. Yet when I create an xp object for a row in that table, make a change to other fields, and then save the record, XPO creates an update statement that includes updating the field I set as readonly. This is not what I would have expected. I expected that XPO to ignore readonly fields when creating an update statement for a row. If this is by design, how else can I signal XPO, hopefully within the XPO ORM wizard, to not attempt to update a field that should be ReadOnly in the database. Thanks!
We have closed this ticket because another page addresses its subject:
How to map a property to a read-only database columnXPO is "updating" Readonly Fields
Answers approved by DevExpress Support
We have added support for read-only database columns in XPO. If you would like to test this feature prior to the official 18.2 release, get the preview build in the How to map a property to a read-only database column ticket. Your feedback is welcome.
Other Answers
Hello Jeff.
Setting the Readonly property of a field in the designer makes it generate code for this field as described in the How to: Use Read-Only Persistent Properties article. This approach only makes it impossible to programmatically modify the property of the persistent object.
If I understand your requirement correctly, you wish to prevent XPO from updating the database column mapped to a property. While XPO doesn't currently support this functionality out of the box, you can solve your task as described in the How to map a property to a calculated database column (implement a read-only persistent property) ticket.
Thanks for steering me in the right direction. I would strongly recommend that the ReadOnly property also prevents Xpo from including the field in the update statement. It seems obvious that this should be the case. But if not, simply add a builtin-in attribute to accomplish this. What is weird is that such an obvious improvement to XPO has been ignored fro so many years.