共用方式為


RuntimeModel.AddTypeMappingConfiguration 方法

定義

新增純量類型的組態。

public virtual Microsoft.EntityFrameworkCore.Metadata.RuntimeTypeMappingConfiguration AddTypeMappingConfiguration (Type clrType, int? maxLength = default, bool? unicode = default, int? precision = default, int? scale = default, Type? providerPropertyType = default, Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter? valueConverter = default);
abstract member AddTypeMappingConfiguration : Type * Nullable<int> * Nullable<bool> * Nullable<int> * Nullable<int> * Type * Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter -> Microsoft.EntityFrameworkCore.Metadata.RuntimeTypeMappingConfiguration
override this.AddTypeMappingConfiguration : Type * Nullable<int> * Nullable<bool> * Nullable<int> * Nullable<int> * Type * Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter -> Microsoft.EntityFrameworkCore.Metadata.RuntimeTypeMappingConfiguration
Public Overridable Function AddTypeMappingConfiguration (clrType As Type, 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 valueConverter As ValueConverter = Nothing) As RuntimeTypeMappingConfiguration

參數

clrType
Type

屬性將保留的數值型別。

maxLength
Nullable<Int32>

這個屬性類型中允許的資料長度上限。

unicode
Nullable<Boolean>

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

precision
Nullable<Int32>

這個屬性類型中允許的資料有效位數。

scale
Nullable<Int32>

這個屬性類型中允許的資料小數位數。

providerPropertyType
Type

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

valueConverter
ValueConverter

此類型的自訂 ValueConverter

傳回

新建立的屬性。

適用於