語言

ConventionPropertyExtensions.SetMaxLength 方法

定義

設定此屬性允許的最大資料長度。 例如,若屬性為 String ',則為最大字元數。

public static void SetMaxLength(this Microsoft.EntityFrameworkCore.Metadata.IConventionProperty property, int? maxLength, bool fromDataAnnotation = false);
public static int? SetMaxLength(this Microsoft.EntityFrameworkCore.Metadata.IConventionProperty property, int? maxLength, bool fromDataAnnotation = false);
static member SetMaxLength : Microsoft.EntityFrameworkCore.Metadata.IConventionProperty * Nullable<int> * bool -> unit
static member SetMaxLength : Microsoft.EntityFrameworkCore.Metadata.IConventionProperty * Nullable<int> * bool -> Nullable<int>
<Extension()>
Public Sub SetMaxLength (property As IConventionProperty, maxLength As Nullable(Of Integer), Optional fromDataAnnotation As Boolean = false)
<Extension()>
Public Function SetMaxLength (property As IConventionProperty, maxLength As Nullable(Of Integer), Optional fromDataAnnotation As Boolean = false) As Nullable(Of Integer)

參數

property
IConventionProperty

設定最大長度的性質。

maxLength
Nullable<Int32>

此特性允許的最大資料長度。

fromDataAnnotation
Boolean

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

傳回

配置屬性。

適用於