Share via


RelationalPropertyBuilderExtensions.HasComputedColumnSql Method

Definition

Overloads

HasComputedColumnSql(PropertyBuilder, String, Nullable<Boolean>)

Configures the property to map to a computed column when targeting a relational database.

HasComputedColumnSql(IConventionPropertyBuilder, String, Boolean)

Configures the property to map to a computed column when targeting a relational database.

HasComputedColumnSql(PropertyBuilder)

Configures the property to map to a computed column when targeting a relational database.

HasComputedColumnSql(PropertyBuilder, String)

Configures the property to map to a computed column when targeting a relational database.

HasComputedColumnSql<TProperty>(PropertyBuilder<TProperty>)

Configures the property to map to a computed column when targeting a relational database.

HasComputedColumnSql<TProperty>(PropertyBuilder<TProperty>, String)

Configures the property to map to a computed column when targeting a relational database.

HasComputedColumnSql<TProperty>(PropertyBuilder<TProperty>, String, Nullable<Boolean>)

Configures the property to map to a computed column when targeting a relational database.

HasComputedColumnSql(PropertyBuilder, String, Nullable<Boolean>)

Configures the property to map to a computed column when targeting a relational database.

public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasComputedColumnSql (this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder propertyBuilder, string sql, bool? stored);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasComputedColumnSql (this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder propertyBuilder, string? sql, bool? stored);
static member HasComputedColumnSql : Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder * string * Nullable<bool> -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
<Extension()>
Public Function HasComputedColumnSql (propertyBuilder As PropertyBuilder, sql As String, stored As Nullable(Of Boolean)) As PropertyBuilder

Parameters

propertyBuilder
PropertyBuilder

The builder for the property being configured.

sql
String

The SQL expression that computes values for the column.

stored
Nullable<Boolean>

If true, the computed value is calculated on row modification and stored in the database like a regular column. If false, the value is computed when the value is read, and does not occupy any actual storage. null selects the database provider default.

Returns

The same builder instance so that multiple calls can be chained.

Remarks

See Database default values for more information and examples.

Applies to

HasComputedColumnSql(IConventionPropertyBuilder, String, Boolean)

Configures the property to map to a computed column when targeting a relational database.

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

Parameters

propertyBuilder
IConventionPropertyBuilder

The builder for the property being configured.

sql
String

The SQL expression that computes values for the column.

fromDataAnnotation
Boolean

Indicates whether the configuration was specified using a data annotation.

Returns

The same builder instance if the configuration was applied, null otherwise.

Remarks

See Database default values for more information and examples.

Applies to

HasComputedColumnSql(PropertyBuilder)

Configures the property to map to a computed column when targeting a relational database.

public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasComputedColumnSql (this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder propertyBuilder);
static member HasComputedColumnSql : Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
<Extension()>
Public Function HasComputedColumnSql (propertyBuilder As PropertyBuilder) As PropertyBuilder

Parameters

propertyBuilder
PropertyBuilder

The builder for the property being configured.

Returns

The same builder instance so that multiple calls can be chained.

Remarks

When called with no arguments, this method tells EF that a column is computed without needing to specify the actual SQL used to computed it. This can be useful when mapping EF to an existing database.

See Database default values for more information and examples.

Applies to

HasComputedColumnSql(PropertyBuilder, String)

Configures the property to map to a computed column when targeting a relational database.

public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasComputedColumnSql (this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder propertyBuilder, string sql);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasComputedColumnSql (this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder propertyBuilder, string? sql);
static member HasComputedColumnSql : Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
<Extension()>
Public Function HasComputedColumnSql (propertyBuilder As PropertyBuilder, sql As String) As PropertyBuilder

Parameters

propertyBuilder
PropertyBuilder

The builder for the property being configured.

sql
String

The SQL expression that computes values for the column.

Returns

The same builder instance so that multiple calls can be chained.

Remarks

See Database default values for more information and examples.

Applies to

HasComputedColumnSql<TProperty>(PropertyBuilder<TProperty>)

Configures the property to map to a computed column when targeting a relational database.

public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasComputedColumnSql<TProperty> (this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> propertyBuilder);
static member HasComputedColumnSql : Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property> -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
<Extension()>
Public Function HasComputedColumnSql(Of TProperty) (propertyBuilder As PropertyBuilder(Of TProperty)) As PropertyBuilder(Of TProperty)

Type Parameters

TProperty

The type of the property being configured.

Parameters

propertyBuilder
PropertyBuilder<TProperty>

The builder for the property being configured.

Returns

The same builder instance so that multiple calls can be chained.

Remarks

When called with no arguments, this method tells EF that a column is computed without needing to specify the actual SQL used to computed it. This can be useful when mapping EF to an existing database.

See Database default values for more information and examples.

Applies to

HasComputedColumnSql<TProperty>(PropertyBuilder<TProperty>, String)

Configures the property to map to a computed column when targeting a relational database.

public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasComputedColumnSql<TProperty> (this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> propertyBuilder, string sql);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasComputedColumnSql<TProperty> (this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> propertyBuilder, string? sql);
static member HasComputedColumnSql : Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property> * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
<Extension()>
Public Function HasComputedColumnSql(Of TProperty) (propertyBuilder As PropertyBuilder(Of TProperty), sql As String) As PropertyBuilder(Of TProperty)

Type Parameters

TProperty

The type of the property being configured.

Parameters

propertyBuilder
PropertyBuilder<TProperty>

The builder for the property being configured.

sql
String

The SQL expression that computes values for the column.

Returns

The same builder instance so that multiple calls can be chained.

Remarks

See Database default values for more information and examples.

Applies to

HasComputedColumnSql<TProperty>(PropertyBuilder<TProperty>, String, Nullable<Boolean>)

Configures the property to map to a computed column when targeting a relational database.

public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasComputedColumnSql<TProperty> (this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> propertyBuilder, string sql, bool? stored);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasComputedColumnSql<TProperty> (this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> propertyBuilder, string? sql, bool? stored);
static member HasComputedColumnSql : Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property> * string * Nullable<bool> -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
<Extension()>
Public Function HasComputedColumnSql(Of TProperty) (propertyBuilder As PropertyBuilder(Of TProperty), sql As String, stored As Nullable(Of Boolean)) As PropertyBuilder(Of TProperty)

Type Parameters

TProperty

The type of the property being configured.

Parameters

propertyBuilder
PropertyBuilder<TProperty>

The builder for the property being configured.

sql
String

The SQL expression that computes values for the column.

stored
Nullable<Boolean>

If true, the computed value is calculated on row modification and stored in the database like a regular column. If false, the value is computed when the value is read, and does not occupy any actual storage. null selects the database provider default.

Returns

The same builder instance so that multiple calls can be chained.

Remarks

See Database default values for more information and examples.

Applies to