共用方式為


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

指出是否使用資料批註來指定組態。

傳回

已設定的屬性。

適用於