Table of Contents

Interface IConventionDiscriminatorBuilder

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

Provides a simple API surface for setting discriminator values from conventions.

public interface IConventionDiscriminatorBuilder

Remarks

See Model building conventions for more information and examples.

Properties

EntityType

Gets the entity type on which the discriminator is being configured.

IConventionEntityType EntityType { get; }

Property Value

IConventionEntityType

Methods

CanSetIsComplete(bool, bool)

Returns a value indicating whether the discriminator mapping is complete can be set from this configuration source.

bool CanSetIsComplete(bool complete, bool fromDataAnnotation = false)

Parameters

complete bool

The value indicating if this discriminator mapping is complete.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the discriminator value can be set from this configuration source.

CanSetValue(IConventionEntityType, object?, bool)

Returns a value indicating whether the discriminator value can be set from this configuration source.

bool CanSetValue(IConventionEntityType entityType, object? value, bool fromDataAnnotation = false)

Parameters

entityType IConventionEntityType

The entity type for which a discriminator value is being set.

value object

The discriminator value.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the discriminator value can be set from this configuration source.

CanSetValue(object?, bool)

Returns a value indicating whether the discriminator value can be set from this configuration source.

bool CanSetValue(object? value, bool fromDataAnnotation = false)

Parameters

value object

The discriminator value.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the discriminator value can be set from this configuration source.

HasValue(IConventionEntityType, object?, bool)

Configures the discriminator value to use for entities of the given type.

IConventionDiscriminatorBuilder? HasValue(IConventionEntityType entityType, object? value, bool fromDataAnnotation = false)

Parameters

entityType IConventionEntityType

The entity type for which a discriminator value is being set.

value object

The discriminator value.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IConventionDiscriminatorBuilder

The same builder so that multiple calls can be chained.

HasValue(object?, bool)

Configures the discriminator value to use.

IConventionDiscriminatorBuilder? HasValue(object? value, bool fromDataAnnotation = false)

Parameters

value object

The discriminator value.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IConventionDiscriminatorBuilder

The same builder so that multiple calls can be chained.

IsComplete(bool, bool)

Configures if the discriminator mapping is complete.

IConventionDiscriminatorBuilder? IsComplete(bool complete, bool fromDataAnnotation = false)

Parameters

complete bool

The value indicating if this discriminator mapping is complete.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IConventionDiscriminatorBuilder

The same builder so that multiple calls can be chained.