Share via


CosmosModelBuilderExtensions.HasRootDiscriminatorInJsonId Method

Definition

Includes the discriminator value of the root entity type in the JSON "id" value. This allows types with the same primary key to be saved in the same container, while still allowing "ReadItem" to be used for lookups of an unknown type.

public static Microsoft.EntityFrameworkCore.ModelBuilder HasRootDiscriminatorInJsonId (this Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder, bool? includeDiscriminator = True);
static member HasRootDiscriminatorInJsonId : Microsoft.EntityFrameworkCore.ModelBuilder * Nullable<bool> -> Microsoft.EntityFrameworkCore.ModelBuilder
<Extension()>
Public Function HasRootDiscriminatorInJsonId (modelBuilder As ModelBuilder, Optional includeDiscriminator As Nullable(Of Boolean) = True) As ModelBuilder

Parameters

modelBuilder
ModelBuilder

The model builder.

includeDiscriminator
Nullable<Boolean>

true to include the discriminator, false to not include the discriminator, null to revert to the default setting.

Returns

The same builder instance so that multiple calls can be chained.

Remarks

See Modeling entity types and relationships, and Accessing Azure Cosmos DB with EF Core for more information and examples.

Applies to