Ticket T548971
Visible to All Users

How to update the OptimisticLockField only when persistent properties are changed

created 8 years ago

[DevExpress Support Team: CLONED FROM T150240: Security: Persist changed properties only when saving a changed business object record]
the OptimisticLockField seems to be updated many times even if no other properties on the table have changed.

is there a way to change the behavior to only update that field if a property has changed?

Show previous comments (4)

    I think calling Save might be it, I'll Review the code and let you know.

      ok, that was some older code.

      if contact.Phone == phone, would the object be marked as modified?

      C#
      public static void UpdateContact(IObjectSpace os, string name,string phone) { Person contact = os.GetObjectsQuery<Person>(true) .SingleOrDefault(p => p.FirstName == name) ?? os.CreateObject<Person>(); contact.Phone = phone; os.CommitChanges(); }
      DevExpress Support Team 8 years ago

        Since this code modifies the Phone property of the "contact" (Person) object, the object is marked as modified (if its properties are implemetned accordign to the Unit of Work article).

        Let me know if you need any additional assistance.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.