Entity State

The state module tracks property state during event processing.

Common state values

var quantityState = line._State.Quantity;

var isDirty = quantityState.IsDirty;
var isReadOnly = quantityState.IsReadOnly;
var originalValue = quantityState.OriginalValue;
var validValue = quantityState.ValidValue;
var proposedValue = quantityState.ProposedValue;

When to use it

  • Guard writes in custom logic (IsReadOnly)
  • Compare before/after values (OriginalValue, ValidValue)
  • Check recomputation status (IsDirty)
  • Inspect current set attempt (ProposedValue)

Example: guarded update

if (!order._State.Status.IsReadOnly)
{
    order.Status = SalesOrderStatus.Closed;
}

Notes

  • State is per-entity-instance in the current event context.
  • ProposedValue is useful inside validation and correction flows.
  • Use state checks to keep logic explicit and predictable.