语言

IConventionIndexBuilder.IsUnique(Nullable<Boolean>, Boolean) 方法

定义

配置此索引是否唯一(即每个值集必须唯一)。

public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionIndexBuilder? IsUnique(bool? unique, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionIndexBuilder IsUnique(bool? unique, bool fromDataAnnotation = false);
abstract member IsUnique : Nullable<bool> * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionIndexBuilder
Public Function IsUnique (unique As Nullable(Of Boolean), Optional fromDataAnnotation As Boolean = false) As IConventionIndexBuilder

参数

unique
Nullable<Boolean>

一个值,该值指示索引是否唯一。

fromDataAnnotation
Boolean

指示是否使用数据注释指定了配置。

返回

如果配置了唯一性,则为同一生成器实例, null 否则为同一个生成器实例。

适用于