Skip to main content
.NET Framework 4.5.2+

DelayedAttribute.UpdateModifiedOnly Property

Gets whether the delayed property stores all or only modified values to a data store.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v24.1.dll

NuGet Package: DevExpress.Xpo

Declaration

public bool UpdateModifiedOnly { get; }

Property Value

Type Description
Boolean

true if the delayed property’s value is sent to a data store for update only after it has been modified; otherwise, false.

Remarks

By default, when a persistent object is saved to a data store, all properties (including delayed properties) send their values for update, regardless of whether or not they have been modified. For delayed properties, you can ensure that only modified property values are saved. To accomplish this, pass true as the delayed attribute’s DelayedAttribute.UpdateModifiedOnly parameter. After this, the delayed property’s value is saved only if the XPDelayedProperty.IsModified property returns true.

Example

The following example demonstrates how to delay the loading of the DelayedAttachment property and improve property value update performance, by enabling the DelayedAttribute.UpdateModifiedOnly property.

Note

This solution uses the XPDelayedProperty object explicitly and doesn’t raise property change notifications in all scenarios. You may need to explicitly call the Session.Save method after modifying the property value to save changes. Alternatively, implement the delayed property as shown in the Delayed Loading article.

using DevExpress.Xpo;

public class Customer : XPObject {
   // ...
   private XPDelayedProperty document = new XPDelayedProperty();
   // Improve update performance for the property's value
   // by passing true as the attribute's
   // updateModifiedOnly parameter.
   [Delayed(nameof(document), true)]
   public Byte[] DelayedAttachment {
      get { return (Byte[])document.Value; }
      set { document.Value = value; }
   }
}
See Also