Share via


TableBuilder.HasCheckConstraint(String, String) Method

Definition

Configures a database check constraint when targeting a relational database.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.CheckConstraintBuilder HasCheckConstraint (string name, string? sql);
abstract member HasCheckConstraint : string * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.CheckConstraintBuilder
override this.HasCheckConstraint : string * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.CheckConstraintBuilder
Public Overridable Function HasCheckConstraint (name As String, sql As String) As CheckConstraintBuilder

Parameters

name
String

The name of the check constraint.

sql
String

The logical constraint sql used in the check constraint.

Returns

A builder to configure the check constraint.

Remarks

See Database check constraints for more information and examples.

Applies to