ModelBuilder.SharedTypeEntity Method

Definition

Overloads

SharedTypeEntity(String, Type)

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

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.

SharedTypeEntity(String, Type, Action<EntityTypeBuilder>)

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

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.

This overload allows configuration of the entity type to be done in line in the method call rather than being chained after a call to Entity(String). This allows additional configuration at the model level to be chained after configuration for the entity type.

SharedTypeEntity<TEntity>(String, Action<EntityTypeBuilder<TEntity>>)

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

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.

This overload allows configuration of the entity type to be done inline in the method call rather than being chained after a call to Entity<TEntity>(). This allows additional configuration at the model level to be chained after configuration for the entity type.

SharedTypeEntity<TEntity>(String)

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

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.

SharedTypeEntity(String, Type)

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

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.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder SharedTypeEntity (string name, Type type);
abstract member SharedTypeEntity : string * Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder
override this.SharedTypeEntity : string * Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder
Public Overridable Function SharedTypeEntity (name As String, type As Type) As EntityTypeBuilder

Parameters

name
String

The name of the entity type to be configured.

type
Type

The CLR type of the entity type to be configured.

Returns

EntityTypeBuilder

An object that can be used to configure the entity type.

Remarks

See Modeling entity types and Shared entity types for more information.

Applies to

SharedTypeEntity(String, Type, Action<EntityTypeBuilder>)

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

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.

This overload allows configuration of the entity type to be done in line in the method call rather than being chained after a call to Entity(String). This allows additional configuration at the model level to be chained after configuration for the entity type.

public virtual Microsoft.EntityFrameworkCore.ModelBuilder SharedTypeEntity (string name, Type type, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder> buildAction);
abstract member SharedTypeEntity : string * Type * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder> -> Microsoft.EntityFrameworkCore.ModelBuilder
override this.SharedTypeEntity : string * Type * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder> -> Microsoft.EntityFrameworkCore.ModelBuilder
Public Overridable Function SharedTypeEntity (name As String, type As Type, buildAction As Action(Of EntityTypeBuilder)) As ModelBuilder

Parameters

name
String

The name of the entity type to be configured.

type
Type

The CLR type of the entity type to be configured.

buildAction
Action<EntityTypeBuilder>

An action that performs configuration of the entity type.

Returns

ModelBuilder

The same ModelBuilder instance so that additional configuration calls can be chained.

Remarks

See Modeling entity types and Shared entity types for more information.

Applies to

SharedTypeEntity<TEntity>(String, Action<EntityTypeBuilder<TEntity>>)

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

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.

This overload allows configuration of the entity type to be done inline in the method call rather than being chained after a call to Entity<TEntity>(). This allows additional configuration at the model level to be chained after configuration for the entity type.

public virtual Microsoft.EntityFrameworkCore.ModelBuilder SharedTypeEntity<TEntity> (string name, Action<Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity>> buildAction) where TEntity : class;
abstract member SharedTypeEntity : string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity>> -> Microsoft.EntityFrameworkCore.ModelBuilder (requires 'Entity : null)
override this.SharedTypeEntity : string * Action<Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity>> -> Microsoft.EntityFrameworkCore.ModelBuilder (requires 'Entity : null)
Public Overridable Function SharedTypeEntity(Of TEntity As Class) (name As String, buildAction As Action(Of EntityTypeBuilder(Of TEntity))) As ModelBuilder

Type Parameters

TEntity

The CLR type of the entity type to be configured.

Parameters

name
String

The name of the entity type to be configured.

buildAction
Action<EntityTypeBuilder<TEntity>>

An action that performs configuration of the entity type.

Returns

ModelBuilder

The same ModelBuilder instance so that additional configuration calls can be chained.

Remarks

See Modeling entity types and Shared entity types for more information.

Applies to

SharedTypeEntity<TEntity>(String)

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

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.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TEntity> SharedTypeEntity<TEntity> (string name) where TEntity : class;
abstract member SharedTypeEntity : string -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'Entity : null)
override this.SharedTypeEntity : string -> Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<'Entity (requires 'Entity : null)> (requires 'Entity : null)
Public Overridable Function SharedTypeEntity(Of TEntity As Class) (name As String) As EntityTypeBuilder(Of TEntity)

Type Parameters

TEntity

The CLR type of the entity type to be configured.

Parameters

name
String

The name of the entity type to be configured.

Returns

EntityTypeBuilder<TEntity>

An object that can be used to configure the entity type.

Remarks

See Modeling entity types and Shared entity types for more information.

Applies to