Table of Contents

Interface IConventionKeyBuilder

Namespace
Microsoft.EntityFrameworkCore.Metadata.Builders
Assembly
Microsoft.EntityFrameworkCore.dll

Provides a simple API surface for configuring an IConventionKey from conventions.

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

public interface IConventionKeyBuilder : IConventionAnnotatableBuilder
Inherited Members

Remarks

See Model building conventions for more information and examples.

Properties

Metadata

Gets the key being configured.

IConventionKey Metadata { get; }

Property Value

IConventionKey

Methods

HasAnnotation(string, object?, bool)

Sets the annotation stored under the given name. Overwrites the existing annotation if an annotation with the specified name already exists with same or lower ConfigurationSource.

IConventionKeyBuilder? HasAnnotation(string name, object? value, bool fromDataAnnotation = false)

Parameters

name string

The name of the annotation to be set.

value object

The value to be stored in the annotation.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IConventionKeyBuilder

An IConventionKeyBuilder to continue configuration if the annotation was set, null otherwise.

HasNoAnnotation(string, bool)

Removes the annotation with the given name from this object.

IConventionKeyBuilder? HasNoAnnotation(string name, bool fromDataAnnotation = false)

Parameters

name string

The name of the annotation to remove.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IConventionKeyBuilder

An IConventionKeyBuilder to continue configuration if the annotation was set, null otherwise.

HasNonNullAnnotation(string, object?, bool)

Sets the annotation stored under the given name. Overwrites the existing annotation if an annotation with the specified name already exists with same or lower ConfigurationSource. Removes the annotation if null value is specified.

IConventionKeyBuilder? HasNonNullAnnotation(string name, object? value, bool fromDataAnnotation = false)

Parameters

name string

The name of the annotation to be set.

value object

The value to be stored in the annotation. null to remove the annotations.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IConventionKeyBuilder

An IConventionKeyBuilder to continue configuration if the annotation was set or removed, null otherwise.