Skip to content

UniqueFieldSaveBehavior class

namespace: Serenity.Services   assembly: Serenity.Net.Services

Behavior that handles UniqueAttribute on a single field. It checks the unique constraint before save (unless CheckBeforeSave is disabled) by running an existence query. Override BuildUniqueConstraintQuery in a derived behavior, or add your own behavior and set DisableDefaultBehavior on the field, to customize or replace the pre-check.

public class UniqueFieldSaveBehavior : BaseUniqueConstraintSaveBehavior, IFieldBehavior, 
    IImplicitBehavior
parameter description
localizer Text localizer

Public Members

name description
UniqueFieldSaveBehavior(…) Behavior that handles UniqueAttribute on a single field. It checks the unique constraint before save (unless CheckBeforeSave is disabled) by running an existence query. Override BuildUniqueConstraintQuery in a derived behavior, or add your own behavior and set DisableDefaultBehavior on the field, to customize or replace the pre-check.
Target { get; set; }
ActivateFor(…)
virtual OnBeforeSave(…)
override OnBeforeSaveAsync(…)

Remarks

Initializes a new instance of the class.

See Also