Skip to content

Commit

Permalink
Document shared-type entity types
Browse files Browse the repository at this point in the history
Fixes #3394
  • Loading branch information
AndriySvyryd committed Oct 25, 2021
1 parent cebe7f3 commit 2bf81d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions entity-framework/core/modeling/entity-types.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: Entity Types - EF Core
description: How to configure and map entity types using Entity Framework Core
author: roji
ms.date: 10/06/2020
author: AndriySvyryd
ms.date: 10/25/2021
uid: core/modeling/entity-types
---
# Entity Types
Expand Down Expand Up @@ -159,3 +159,12 @@ You can set an arbitrary text comment that gets set on the database table, allow
[!code-csharp[Main](../../../samples/core/Modeling/EntityTypes/FluentAPI/TableComment.cs?name=TableComment&highlight=4)]

***

## Shared-type entity types

> [!NOTE]
> Support for Shared-type entity types was introduced in EF Core 5.0.
Entity types that use the same CLR type are known as shared-type entity types. These entity types need to be configured with a unique name. Whenever a shared-type entity type is used the supplied name needs to be provided in addition to the CLR type. This means that the corresponding `DbSet` property must be implemented using a `Set` call.

[!code-csharp[Main](../../../samples/core/Modeling/ShadowAndIndexerProperties/SharedType.cs?name=SharedType&highlight=3,7)]
4 changes: 2 additions & 2 deletions entity-framework/core/modeling/shadow-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Shadow and Indexer Properties - EF Core
description: Configuring shadow and indexer properties in an Entity Framework Core model
author: AndriySvyryd
ms.date: 10/09/2020
ms.date: 10/25/2021
uid: core/modeling/shadow-properties
---
# Shadow and Indexer Properties
Expand Down Expand Up @@ -59,6 +59,6 @@ If the name supplied to the `IndexerProperty` method matches the name of an exis
> [!NOTE]
> Support for Property bag entity types was introduced in EF Core 5.0.
Entity types that contain only indexer properties are known as property bag entity types. These entity types don't have shadow properties, instead EF will create indexer properties. Currently only `Dictionary<string, object>` is supported as a property bag entity type. It must be configured as a shared entity type with a unique name and the corresponding `DbSet` property must be implemented using a `Set` call.
Entity types that contain only indexer properties are known as property bag entity types. These entity types don't have shadow properties, instead EF will create indexer properties. Currently only `Dictionary<string, object>` is supported as a property bag entity type. It must be configured as a [shared-type entity type](entity-types.md#shared-type-entity-types) with a unique name and the corresponding `DbSet` property must be implemented using a `Set` call.

[!code-csharp[Main](../../../samples/core/Modeling/ShadowAndIndexerProperties/SharedType.cs?name=SharedType&highlight=3,7)]

0 comments on commit 2bf81d7

Please sign in to comment.