BaseUniqueConstraintSaveBehavior class
namespace: Serenity.Services assembly: Serenity.Net.Services
Base class for unique constraint save behaviors (e.g. UniqueFieldSaveBehavior and UniqueConstraintSaveBehavior). Contains the shared query building and validation logic, with virtual hooks so applications can customize how the pre-check query is built, for example to apply row-level (tenant/owner) scoping so the pre-check matches the actual database unique constraint.
public abstract class BaseUniqueConstraintSaveBehavior : BaseSaveBehaviorAsync, ISaveBehaviorSync
Protected Members
| name | description |
|---|---|
| BaseUniqueConstraintSaveBehavior() | The default constructor. |
| virtual BuildUniqueConstraintQuery(…) | Builds the query used to check the unique constraint. Override this method to customize the pre-check, for example to add row-level scoping (tenant/owner filters) so that the check matches the actual database unique constraint, or to skip the pre-check entirely. |
| virtual ValidateUniqueConstraint(…) | Validates that no record violates the unique constraint defined by the passed fields. |
| virtual ValidateUniqueConstraintAsync(…) | Asynchronous version of ValidateUniqueConstraint. |
| static UniqueViolation(…) | Creates the validation error that is thrown when a unique constraint is violated. |
See Also
- class BaseSaveBehaviorAsync
- interface ISaveBehaviorSync
- Source: BaseUniqueConstraintSaveBehavior.cs