CosmosEntityTypeBuilderExtensions.HasShadowId Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| HasShadowId(EntityTypeBuilder, Nullable<Boolean>) |
Forces model building to always create a "__id" shadow property mapped to the JSON "id". This was the default behavior before EF Core 9.0. |
| HasShadowId(IConventionEntityTypeBuilder, Nullable<Boolean>, Boolean) |
Forces model building to always create a "__id" shadow property mapped to the JSON "id". This was the default behavior before EF Core 9.0. |
| HasShadowId<TEntity>(EntityTypeBuilder<TEntity>, Nullable<Boolean>) |
Forces model building to always create a "__id" shadow property mapped to the JSON "id". This was the default behavior before EF Core 9.0. Note that an "__id" property is always created if the primary key is not a single string property, or if the discriminator is included in the JSON "id". |
HasShadowId(EntityTypeBuilder, Nullable<Boolean>)
Forces model building to always create a "__id" shadow property mapped to the JSON "id". This was the default behavior before EF Core 9.0.
public static Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder HasShadowId(this Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder entityTypeBuilder, bool? alwaysCreate = True);
static member HasShadowId : Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder * Nullable<bool> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder
<Extension()>
Public Function HasShadowId (entityTypeBuilder As EntityTypeBuilder, Optional alwaysCreate As Nullable(Of Boolean) = True) As EntityTypeBuilder
Parameters
- entityTypeBuilder
- EntityTypeBuilder
The builder for the entity type being configured.
true to force __id creation, false to not force __id creation,
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
HasShadowId(IConventionEntityTypeBuilder, Nullable<Boolean>, Boolean)
Forces model building to always create a "__id" shadow property mapped to the JSON "id". This was the default behavior before EF Core 9.0.
public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder? HasShadowId(this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder entityTypeBuilder, bool? alwaysCreate, bool fromDataAnnotation = false);
static member HasShadowId : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder * Nullable<bool> * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder
<Extension()>
Public Function HasShadowId (entityTypeBuilder As IConventionEntityTypeBuilder, alwaysCreate As Nullable(Of Boolean), Optional fromDataAnnotation As Boolean = false) As IConventionEntityTypeBuilder
Parameters
- entityTypeBuilder
- IConventionEntityTypeBuilder
The builder for the entity type being configured.
true to force __id creation, false to not force __id creation,
null to revert to the default setting.
- fromDataAnnotation
- Boolean
Indicates whether the configuration was specified using a data annotation.
Returns
The same builder instance if the configuration was applied, null otherwise.
Remarks
See Modeling entity types and relationships, and Accessing Azure Cosmos DB with EF Core for more information and examples.
Applies to
HasShadowId<TEntity>(EntityTypeBuilder<TEntity>, Nullable<Boolean>)
Forces model building to always create a "__id" shadow property mapped to the JSON "id". This was the default behavior before EF Core 9.0. Note that an "__id" property is always created if the primary key is not a single string property, or if the discriminator is included in the JSON "id".
public static Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> HasShadowId<TEntity>(this Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> entityTypeBuilder, bool? alwaysCreate = True) where TEntity : class;
static member HasShadowId : Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> * Nullable<bool> -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'Entity : null)
<Extension()>
Public Function HasShadowId(Of TEntity As Class) (entityTypeBuilder As EntityTypeBuilder(Of TEntity), Optional alwaysCreate As Nullable(Of Boolean) = True) As EntityTypeBuilder(Of TEntity)
Type Parameters
- TEntity
Parameters
- entityTypeBuilder
- EntityTypeBuilder<TEntity>
The builder for the entity type being configured.
true to force __id creation, false to not force __id creation,
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.