共用方式為


RuntimeEntityType.AddProperty 方法

定義

多載

AddProperty(String, Type, PropertyInfo, FieldInfo, PropertyAccessMode, Boolean, Boolean, ValueGenerated, PropertySaveBehavior, PropertySaveBehavior, Nullable<Int32>, Nullable<Boolean>, Nullable<Int32>, Nullable<Int32>, Type, Func<IProperty,IEntityType,ValueGenerator>, ValueConverter, ValueComparer, ValueComparer, CoreTypeMapping)

將屬性加入至這個實體類型。

AddProperty(String, Type, PropertyInfo, FieldInfo, PropertyAccessMode, Boolean, Boolean, ValueGenerated, PropertySaveBehavior, PropertySaveBehavior, Nullable<Int32>, Nullable<Boolean>, Nullable<Int32>, Nullable<Int32>, Type, Func<IProperty,IEntityType,ValueGenerator>, ValueConverter, ValueComparer, ValueComparer, ValueComparer, CoreTypeMapping)

將屬性加入至這個實體類型。

AddProperty(String, Type, PropertyInfo, FieldInfo, PropertyAccessMode, Boolean, Boolean, ValueGenerated, PropertySaveBehavior, PropertySaveBehavior, Nullable<Int32>, Nullable<Boolean>, Nullable<Int32>, Nullable<Int32>, Type, Func<IProperty,IEntityType,ValueGenerator>, ValueConverter, ValueComparer, ValueComparer, CoreTypeMapping)

將屬性加入至這個實體類型。

public virtual Microsoft.EntityFrameworkCore.Metadata.RuntimeProperty AddProperty (string name, Type clrType, System.Reflection.PropertyInfo? propertyInfo = default, System.Reflection.FieldInfo? fieldInfo = default, Microsoft.EntityFrameworkCore.PropertyAccessMode propertyAccessMode = Microsoft.EntityFrameworkCore.PropertyAccessMode.PreferField, bool nullable = false, bool concurrencyToken = false, Microsoft.EntityFrameworkCore.Metadata.ValueGenerated valueGenerated = Microsoft.EntityFrameworkCore.Metadata.ValueGenerated.Never, Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior beforeSaveBehavior = Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior.Save, Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior afterSaveBehavior = Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior.Save, int? maxLength = default, bool? unicode = default, int? precision = default, int? scale = default, Type? providerPropertyType = default, Func<Microsoft.EntityFrameworkCore.Metadata.IProperty,Microsoft.EntityFrameworkCore.Metadata.IEntityType,Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator>? valueGeneratorFactory = default, Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter? valueConverter = default, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer = default, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? keyValueComparer = default, Microsoft.EntityFrameworkCore.Storage.CoreTypeMapping? typeMapping = default);
abstract member AddProperty : string * Type * System.Reflection.PropertyInfo * System.Reflection.FieldInfo * Microsoft.EntityFrameworkCore.PropertyAccessMode * bool * bool * Microsoft.EntityFrameworkCore.Metadata.ValueGenerated * Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior * Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior * Nullable<int> * Nullable<bool> * Nullable<int> * Nullable<int> * Type * Func<Microsoft.EntityFrameworkCore.Metadata.IProperty, Microsoft.EntityFrameworkCore.Metadata.IEntityType, Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator> * Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.Storage.CoreTypeMapping -> Microsoft.EntityFrameworkCore.Metadata.RuntimeProperty
override this.AddProperty : string * Type * System.Reflection.PropertyInfo * System.Reflection.FieldInfo * Microsoft.EntityFrameworkCore.PropertyAccessMode * bool * bool * Microsoft.EntityFrameworkCore.Metadata.ValueGenerated * Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior * Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior * Nullable<int> * Nullable<bool> * Nullable<int> * Nullable<int> * Type * Func<Microsoft.EntityFrameworkCore.Metadata.IProperty, Microsoft.EntityFrameworkCore.Metadata.IEntityType, Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator> * Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.Storage.CoreTypeMapping -> Microsoft.EntityFrameworkCore.Metadata.RuntimeProperty
Public Overridable Function AddProperty (name As String, clrType As Type, Optional propertyInfo As PropertyInfo = Nothing, Optional fieldInfo As FieldInfo = Nothing, Optional propertyAccessMode As PropertyAccessMode = Microsoft.EntityFrameworkCore.PropertyAccessMode.PreferField, Optional nullable As Boolean = false, Optional concurrencyToken As Boolean = false, Optional valueGenerated As ValueGenerated = Microsoft.EntityFrameworkCore.Metadata.ValueGenerated.Never, Optional beforeSaveBehavior As PropertySaveBehavior = Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior.Save, Optional afterSaveBehavior As PropertySaveBehavior = Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior.Save, Optional maxLength As Nullable(Of Integer) = Nothing, Optional unicode As Nullable(Of Boolean) = Nothing, Optional precision As Nullable(Of Integer) = Nothing, Optional scale As Nullable(Of Integer) = Nothing, Optional providerPropertyType As Type = Nothing, Optional valueGeneratorFactory As Func(Of IProperty, IEntityType, ValueGenerator) = Nothing, Optional valueConverter As ValueConverter = Nothing, Optional valueComparer As ValueComparer = Nothing, Optional keyValueComparer As ValueComparer = Nothing, Optional typeMapping As CoreTypeMapping = Nothing) As RuntimeProperty

參數

name
String

要加入的屬性名稱。

clrType
Type

屬性將保留的數值型別。

propertyInfo
PropertyInfo

對應的 CLR 屬性或 null 陰影屬性。

fieldInfo
FieldInfo

陰影屬性的對應 CLR 欄位或 null

propertyAccessMode
PropertyAccessMode

PropertyAccessMode用於這個屬性的 。

nullable
Boolean

值,指出這個屬性是否可以包含 null

concurrencyToken
Boolean

值,指出這個屬性是否做為並行權杖使用。

valueGenerated
ValueGenerated

值,指出資料庫將產生這個屬性的值。

beforeSaveBehavior
PropertySaveBehavior

值,指出是否可以在實體儲存至資料庫之前修改這個屬性。

afterSaveBehavior
PropertySaveBehavior

值,指出這個屬性是否可以在實體儲存至資料庫之後修改。

maxLength
Nullable<Int32>

此屬性中允許的資料長度上限。

unicode
Nullable<Boolean>

值,指出屬性是否可以保存 Unicode 字元。

precision
Nullable<Int32>

此屬性中允許的資料有效位數。

scale
Nullable<Int32>

這個屬性中允許的資料規模。

providerPropertyType
Type

屬性值在傳送至資料庫提供者之前將轉換成的類型。

valueGeneratorFactory
Func<IProperty,IEntityType,ValueGenerator>

已設定為產生此屬性值的處理站,如果有的話。

valueConverter
ValueConverter

這個屬性的自訂 ValueConverter 集。

valueComparer
ValueComparer

ValueComparer這個屬性的 。

keyValueComparer
ValueComparer

ValueComparer 搭配這個屬性之索引鍵使用的 。

typeMapping
CoreTypeMapping

CoreTypeMapping這個屬性的 。

傳回

新建立的屬性。

適用於

AddProperty(String, Type, PropertyInfo, FieldInfo, PropertyAccessMode, Boolean, Boolean, ValueGenerated, PropertySaveBehavior, PropertySaveBehavior, Nullable<Int32>, Nullable<Boolean>, Nullable<Int32>, Nullable<Int32>, Type, Func<IProperty,IEntityType,ValueGenerator>, ValueConverter, ValueComparer, ValueComparer, ValueComparer, CoreTypeMapping)

將屬性加入至這個實體類型。

public virtual Microsoft.EntityFrameworkCore.Metadata.RuntimeProperty AddProperty (string name, Type clrType, System.Reflection.PropertyInfo? propertyInfo = default, System.Reflection.FieldInfo? fieldInfo = default, Microsoft.EntityFrameworkCore.PropertyAccessMode propertyAccessMode = Microsoft.EntityFrameworkCore.PropertyAccessMode.PreferField, bool nullable = false, bool concurrencyToken = false, Microsoft.EntityFrameworkCore.Metadata.ValueGenerated valueGenerated = Microsoft.EntityFrameworkCore.Metadata.ValueGenerated.Never, Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior beforeSaveBehavior = Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior.Save, Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior afterSaveBehavior = Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior.Save, int? maxLength = default, bool? unicode = default, int? precision = default, int? scale = default, Type? providerPropertyType = default, Func<Microsoft.EntityFrameworkCore.Metadata.IProperty,Microsoft.EntityFrameworkCore.Metadata.IEntityType,Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator>? valueGeneratorFactory = default, Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter? valueConverter = default, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer = default, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? keyValueComparer = default, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? providerValueComparer = default, Microsoft.EntityFrameworkCore.Storage.CoreTypeMapping? typeMapping = default);
abstract member AddProperty : string * Type * System.Reflection.PropertyInfo * System.Reflection.FieldInfo * Microsoft.EntityFrameworkCore.PropertyAccessMode * bool * bool * Microsoft.EntityFrameworkCore.Metadata.ValueGenerated * Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior * Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior * Nullable<int> * Nullable<bool> * Nullable<int> * Nullable<int> * Type * Func<Microsoft.EntityFrameworkCore.Metadata.IProperty, Microsoft.EntityFrameworkCore.Metadata.IEntityType, Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator> * Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.Storage.CoreTypeMapping -> Microsoft.EntityFrameworkCore.Metadata.RuntimeProperty
override this.AddProperty : string * Type * System.Reflection.PropertyInfo * System.Reflection.FieldInfo * Microsoft.EntityFrameworkCore.PropertyAccessMode * bool * bool * Microsoft.EntityFrameworkCore.Metadata.ValueGenerated * Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior * Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior * Nullable<int> * Nullable<bool> * Nullable<int> * Nullable<int> * Type * Func<Microsoft.EntityFrameworkCore.Metadata.IProperty, Microsoft.EntityFrameworkCore.Metadata.IEntityType, Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator> * Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.Storage.CoreTypeMapping -> Microsoft.EntityFrameworkCore.Metadata.RuntimeProperty
Public Overridable Function AddProperty (name As String, clrType As Type, Optional propertyInfo As PropertyInfo = Nothing, Optional fieldInfo As FieldInfo = Nothing, Optional propertyAccessMode As PropertyAccessMode = Microsoft.EntityFrameworkCore.PropertyAccessMode.PreferField, Optional nullable As Boolean = false, Optional concurrencyToken As Boolean = false, Optional valueGenerated As ValueGenerated = Microsoft.EntityFrameworkCore.Metadata.ValueGenerated.Never, Optional beforeSaveBehavior As PropertySaveBehavior = Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior.Save, Optional afterSaveBehavior As PropertySaveBehavior = Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior.Save, Optional maxLength As Nullable(Of Integer) = Nothing, Optional unicode As Nullable(Of Boolean) = Nothing, Optional precision As Nullable(Of Integer) = Nothing, Optional scale As Nullable(Of Integer) = Nothing, Optional providerPropertyType As Type = Nothing, Optional valueGeneratorFactory As Func(Of IProperty, IEntityType, ValueGenerator) = Nothing, Optional valueConverter As ValueConverter = Nothing, Optional valueComparer As ValueComparer = Nothing, Optional keyValueComparer As ValueComparer = Nothing, Optional providerValueComparer As ValueComparer = Nothing, Optional typeMapping As CoreTypeMapping = Nothing) As RuntimeProperty

參數

name
String

要加入的屬性名稱。

clrType
Type

屬性將保留的數值型別。

propertyInfo
PropertyInfo

對應的 CLR 屬性或 null 陰影屬性。

fieldInfo
FieldInfo

陰影屬性的對應 CLR 欄位或 null

propertyAccessMode
PropertyAccessMode

PropertyAccessMode用於這個屬性的 。

nullable
Boolean

值,指出這個屬性是否可以包含 null

concurrencyToken
Boolean

值,指出這個屬性是否做為並行權杖使用。

valueGenerated
ValueGenerated

值,指出資料庫將產生這個屬性的值。

beforeSaveBehavior
PropertySaveBehavior

值,指出是否可以在實體儲存至資料庫之前修改這個屬性。

afterSaveBehavior
PropertySaveBehavior

值,指出這個屬性是否可以在實體儲存至資料庫之後修改。

maxLength
Nullable<Int32>

此屬性中允許的資料長度上限。

unicode
Nullable<Boolean>

值,指出屬性是否可以保存 Unicode 字元。

precision
Nullable<Int32>

此屬性中允許的資料有效位數。

scale
Nullable<Int32>

這個屬性中允許的資料規模。

providerPropertyType
Type

屬性值在傳送至資料庫提供者之前將轉換成的類型。

valueGeneratorFactory
Func<IProperty,IEntityType,ValueGenerator>

已設定為產生此屬性值的處理站,如果有的話。

valueConverter
ValueConverter

這個屬性的自訂 ValueConverter 集。

valueComparer
ValueComparer

ValueComparer這個屬性的 。

keyValueComparer
ValueComparer

ValueComparer 搭配這個屬性之索引鍵使用的 。

providerValueComparer
ValueComparer

ValueComparer要用於這個屬性之提供者值的 。

typeMapping
CoreTypeMapping

CoreTypeMapping這個屬性的 。

傳回

新建立的屬性。

適用於