Share via


KeyBuilder<T> Class

Definition

Provides a simple API for configuring a IMutableKey.

public class KeyBuilder<T> : Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder
type KeyBuilder<'T> = class
    inherit KeyBuilder
Public Class KeyBuilder(Of T)
Inherits KeyBuilder

Type Parameters

T
Inheritance
KeyBuilder<T>

Remarks

Instances of this class are returned from methods when using the ModelBuilder API and it is not designed to be directly constructed in your application code.

See Modeling entity types and relationships for more information and examples.

Constructors

KeyBuilder<T>(IMutableKey)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

Properties

Metadata

The key being configured.

(Inherited from KeyBuilder)

Methods

HasAnnotation(String, Object)

Adds or updates an annotation on the key. If an annotation with the key specified in annotation already exists its value will be updated.

Explicit Interface Implementations

IInfrastructure<IConventionKeyBuilder>.Instance

The internal builder being used to configure the key.

(Inherited from KeyBuilder)

Extension Methods

HasName(KeyBuilder, String)

Configures the name of the key constraint in the database when targeting a relational database.

HasName<TEntity>(KeyBuilder<TEntity>, String)

Configures the name of the key constraint in the database when targeting a relational database.

HasFillFactor(KeyBuilder, Int32)

Configures whether the key is created with fill factor option when targeting SQL Server.

HasFillFactor<TEntity>(KeyBuilder<TEntity>, Int32)

Configures whether the key is created with fill factor option when targeting SQL Server.

IsClustered(KeyBuilder, Boolean)

Configures whether the key is clustered when targeting SQL Server.

IsClustered<TEntity>(KeyBuilder<TEntity>, Boolean)

Configures whether the key is clustered when targeting SQL Server.

Applies to