KeyBuilder Class

Definition

Provides a simple API for configuring a IMutableKey.

public class KeyBuilder : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.IMutableModel>, Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.Internal.InternalKeyBuilder>
public class KeyBuilder : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.Internal.InternalKeyBuilder>
public class KeyBuilder : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionKeyBuilder>
type KeyBuilder = class
    interface IInfrastructure<IMutableModel>
    interface IInfrastructure<InternalKeyBuilder>
type KeyBuilder = class
    interface IInfrastructure<InternalKeyBuilder>
type KeyBuilder = class
    interface IInfrastructure<IConventionKeyBuilder>
Public Class KeyBuilder
Implements IInfrastructure(Of IMutableModel), IInfrastructure(Of InternalKeyBuilder)
Public Class KeyBuilder
Implements IInfrastructure(Of InternalKeyBuilder)
Public Class KeyBuilder
Implements IInfrastructure(Of IConventionKeyBuilder)
Inheritance
KeyBuilder
Derived
Implements
IInfrastructure<IMutableModel> IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.Internal.InternalKeyBuilder> IInfrastructure<IConventionKeyBuilder>

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(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.

KeyBuilder(InternalKeyBuilder)

This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases.

Properties

Metadata

The key being configured.

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.

IInfrastructure<IMutableModel>.Instance

The model that the key belongs to.

IInfrastructure<InternalKeyBuilder>.Instance

The internal builder being used to configure the key.

Extension Methods

GetInfrastructure<T>(IInfrastructure<T>)

Gets the value from a property that is being hidden using IInfrastructure<T>.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

HasName(KeyBuilder, String)

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

ForSqliteHasName(KeyBuilder, String)

Configures the name of the key constraint in the database when targeting SQLite.

ForSqlServerHasName(KeyBuilder, String)

Configures the name of the key constraint in the database when targeting SQL Server.

ForSqlServerIsClustered(KeyBuilder, Boolean)
Obsolete.

Configures whether the key is clustered when targeting SQL Server.

IsClustered(KeyBuilder, Boolean)

Configures whether the key is clustered when targeting SQL Server.

Applies to