語言

RelationalPropertyBuilderExtensions.HasDefaultValue 方法

定義

多載

名稱 Description
HasDefaultValue(PropertyBuilder)

設定屬性對應的欄位預設值,當針對關聯式資料庫時。

HasDefaultValue(PropertyBuilder, Object)

設定屬性對應的欄位預設值,當針對關聯式資料庫時。

HasDefaultValue(IConventionPropertyBuilder, Object, Boolean)

設定屬性對應的欄位預設值,當針對關聯式資料庫時。

HasDefaultValue<TProperty>(PropertyBuilder<TProperty>)

設定屬性對應的欄位預設值,當針對關聯式資料庫時。

HasDefaultValue<TProperty>(PropertyBuilder<TProperty>, Object)

設定屬性對應的欄位預設值,當針對關聯式資料庫時。

HasDefaultValue(PropertyBuilder)

來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs

設定屬性對應的欄位預設值,當針對關聯式資料庫時。

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

參數

propertyBuilder
PropertyBuilder

正在配置的物業的建商。

傳回

同一個建構實例,這樣可以串接多個呼叫。

備註

當無參數呼叫時,此方法會告訴 EF 欄位有某種預設值限制,無需具體說明。 這在將 EF 映射到現有資料庫時非常有用。

更多資訊與範例請參閱 資料庫預設值 。

適用於

HasDefaultValue(PropertyBuilder, Object)

來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs

設定屬性對應的欄位預設值,當針對關聯式資料庫時。

public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasDefaultValue(this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder propertyBuilder, object value);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasDefaultValue(this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder propertyBuilder, object? value);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasDefaultValue(this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder propertyBuilder, object value = default);
static member HasDefaultValue : Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder * obj -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
<Extension()>
Public Function HasDefaultValue (propertyBuilder As PropertyBuilder, value As Object) As PropertyBuilder
<Extension()>
Public Function HasDefaultValue (propertyBuilder As PropertyBuilder, Optional value As Object = Nothing) As PropertyBuilder

參數

propertyBuilder
PropertyBuilder

正在配置的物業的建商。

value
Object

數據行的預設值。

傳回

同一個建構實例,這樣可以串接多個呼叫。

備註

更多資訊與範例請參閱 資料庫預設值 。

適用於

HasDefaultValue(IConventionPropertyBuilder, Object, Boolean)

來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs

設定屬性對應的欄位預設值,當針對關聯式資料庫時。

public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder? HasDefaultValue(this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder propertyBuilder, object? value, bool fromDataAnnotation = false);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder HasDefaultValue(this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder propertyBuilder, object value, bool fromDataAnnotation = false);
static member HasDefaultValue : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder * obj * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder
<Extension()>
Public Function HasDefaultValue (propertyBuilder As IConventionPropertyBuilder, value As Object, Optional fromDataAnnotation As Boolean = false) As IConventionPropertyBuilder

參數

propertyBuilder
IConventionPropertyBuilder

正在配置的物業的建商。

value
Object

數據行的預設值。

fromDataAnnotation
Boolean

表示配置是否以資料註解方式指定。

傳回

如果設定是套用,則使用同一個建構者實例, null 否則。

備註

更多資訊與範例請參閱 資料庫預設值 。

適用於

HasDefaultValue<TProperty>(PropertyBuilder<TProperty>)

來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs

設定屬性對應的欄位預設值,當針對關聯式資料庫時。

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

類型參數

TProperty

配置的房產類型。

參數

propertyBuilder
PropertyBuilder<TProperty>

正在配置的物業的建商。

傳回

同一個建構實例,這樣可以串接多個呼叫。

備註

當無參數呼叫時,此方法會告訴 EF 欄位有某種預設值限制,無需具體說明。 這在將 EF 映射到現有資料庫時非常有用。

更多資訊與範例請參閱 資料庫預設值 。

適用於

HasDefaultValue<TProperty>(PropertyBuilder<TProperty>, Object)

來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs
來源:
RelationalPropertyBuilderExtensions.cs

設定屬性對應的欄位預設值,當針對關聯式資料庫時。

public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasDefaultValue<TProperty>(this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> propertyBuilder, object value);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasDefaultValue<TProperty>(this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> propertyBuilder, object? value);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> HasDefaultValue<TProperty>(this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty> propertyBuilder, object value = default);
static member HasDefaultValue : Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property> * obj -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<'Property>
<Extension()>
Public Function HasDefaultValue(Of TProperty) (propertyBuilder As PropertyBuilder(Of TProperty), value As Object) As PropertyBuilder(Of TProperty)
<Extension()>
Public Function HasDefaultValue(Of TProperty) (propertyBuilder As PropertyBuilder(Of TProperty), Optional value As Object = Nothing) As PropertyBuilder(Of TProperty)

類型參數

TProperty

配置的房產類型。

參數

propertyBuilder
PropertyBuilder<TProperty>

正在配置的物業的建商。

value
Object

數據行的預設值。

傳回

同一個建構實例,這樣可以串接多個呼叫。

備註

更多資訊與範例請參閱 資料庫預設值 。

適用於