Share via


SqlServerPropertyBuilderExtensions.CanSetDefaultValueSql Method

Definition

Returns a value indicating whether the given default value expression can be set for the column.

public static bool CanSetDefaultValueSql(this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder propertyBuilder, string? sql, string defaultConstraintName, bool fromDataAnnotation = false);
static member CanSetDefaultValueSql : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder * string * string * bool -> bool
<Extension()>
Public Function CanSetDefaultValueSql (propertyBuilder As IConventionPropertyBuilder, sql As String, defaultConstraintName As String, Optional fromDataAnnotation As Boolean = false) As Boolean

Parameters

propertyBuilder
IConventionPropertyBuilder

The builder for the property being configured.

sql
String

The SQL expression for the default value of the column.

defaultConstraintName
String

The default constraint name.

fromDataAnnotation
Boolean

Indicates whether the configuration was specified using a data annotation.

Returns

true if the given default value expression can be set for the column.

Remarks

See Database default values for more information and examples.

Applies to