IConventionModelBuilder.SharedTypeEntity Method

Definition

Returns an object that can be used to configure a given shared type entity type in the model.

public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder SharedTypeEntity (string name, Type type, bool? shouldBeOwned = False, bool fromDataAnnotation = false);
public Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder? SharedTypeEntity (string name, Type type, bool? shouldBeOwned = False, bool fromDataAnnotation = false);
abstract member SharedTypeEntity : string * Type * Nullable<bool> * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionEntityTypeBuilder
Public Function SharedTypeEntity (name As String, type As Type, Optional shouldBeOwned As Nullable(Of Boolean) = False, Optional fromDataAnnotation As Boolean = false) As IConventionEntityTypeBuilder

Parameters

name
String

The name of the entity type to be configured.

type
Type

The type of the entity type to be configured.

shouldBeOwned
Nullable<Boolean>

true if the entity type should be owned, false if the entity type should not be owned

fromDataAnnotation
Boolean

Indicates whether the configuration was specified using a data annotation.

Returns

An object that can be used to configure the entity type if the entity type was added or already part of the model, null otherwise.

Remarks

If an entity type with the provided name is not already part of the model, a new entity type with provided CLR type will be added to the model as shared type entity type.

Shared type entity type is an entity type which can share CLR type with other types in the model but has a unique name and always identified by the name.

Applies to