Table of Contents

Class DiscriminatorBuilder

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

Provides a simple API surface for setting discriminator values.

public class DiscriminatorBuilder : IConventionDiscriminatorBuilder
Inheritance
DiscriminatorBuilder
Implements
Inherited Members

Remarks

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

Constructors

DiscriminatorBuilder(IMutableEntityType)

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.

[EntityFrameworkInternal]
public DiscriminatorBuilder(IMutableEntityType entityType)

Parameters

entityType IMutableEntityType

Properties

EntityTypeBuilder

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.

[EntityFrameworkInternal]
protected virtual InternalEntityTypeBuilder EntityTypeBuilder { get; }

Property Value

InternalEntityTypeBuilder

Methods

HasValue(object?)

Configures the default discriminator value to use.

public virtual DiscriminatorBuilder HasValue(object? value)

Parameters

value object

The discriminator value.

Returns

DiscriminatorBuilder

The same builder so that multiple calls can be chained.

HasValue(string, object?)

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

public virtual DiscriminatorBuilder HasValue(string entityTypeName, object? value)

Parameters

entityTypeName string

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

value object

The discriminator value.

Returns

DiscriminatorBuilder

The same builder so that multiple calls can be chained.

HasValue(Type, object?)

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

public virtual DiscriminatorBuilder HasValue(Type entityType, object? value)

Parameters

entityType Type

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

value object

The discriminator value.

Returns

DiscriminatorBuilder

The same builder so that multiple calls can be chained.

HasValue<TEntity>(object?)

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

public virtual DiscriminatorBuilder HasValue<TEntity>(object? value)

Parameters

value object

The discriminator value.

Returns

DiscriminatorBuilder

The same builder so that multiple calls can be chained.

Type Parameters

TEntity

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

IsComplete(bool)

Configures if the discriminator mapping is complete.

public virtual DiscriminatorBuilder IsComplete(bool complete = true)

Parameters

complete bool

The value indicating if this discriminator mapping is complete.

Returns

DiscriminatorBuilder

The same builder so that multiple calls can be chained.