Click or drag to resize

DomainObjectNoEvents Property

Turns on "No events" mode and returns a class, that will turn it off when Disposed. See remarks for more info.

Namespace:  Aloe.SystemFrameworks.Domain
Assembly:  Aloe.SystemFrameworks.Domain (in Aloe.SystemFrameworks.Domain.dll) Version: 20.1.3.5
Syntax
public NoEventsMode NoEvents { get; }

Property Value

Type: NoEventsMode
Remarks

The "no events" mode will stop all property change events from firing. It is intended to be used inside a using statement, so that at the end of the using, the events will be turned on again. Also, while in the NoEvents section, the access to the setters for data attributes is blocked. This means, that any other threads that need to set values for any data attribute will be blocked until the end of the "no events" section. To be more precise, until the instance of the NoEventsMode class is disposed.

For example, inside the SalesOrderLine class:

partial class SalesOrderLine
{
    partial void OnProductChanged(DataAttributeChangeEventArgs e)
    {
        //the following lines won't fire change events for ProductDescription and UnitPrice
        using (NoEvents)
        {
            ProductDescription = Product.Name;
            UnitPrice = Product.StandardPricePerLot;
        }

        //this will fire the change events for LineAmount
        LineAmount = Quantity * UnitPrice;
    }
}
See Also