Table of Contents

Class RuntimeModelConvention

Namespace
Microsoft.EntityFrameworkCore.Metadata.Conventions
Assembly
Microsoft.EntityFrameworkCore.dll

A convention that creates an optimized copy of the mutable model. This convention is typically implemented by database providers to update provider annotations when creating a read-only model.

public class RuntimeModelConvention : IModelFinalizedConvention, IConvention
Inheritance
RuntimeModelConvention
Implements
Inherited Members

Remarks

See Model building conventions for more information and examples.

Constructors

RuntimeModelConvention(ProviderConventionSetBuilderDependencies)

Creates a new instance of RuntimeModelConvention.

public RuntimeModelConvention(ProviderConventionSetBuilderDependencies dependencies)

Parameters

dependencies ProviderConventionSetBuilderDependencies

Parameter object containing dependencies for this convention.

Properties

Dependencies

Dependencies for this service.

protected virtual ProviderConventionSetBuilderDependencies Dependencies { get; }

Property Value

ProviderConventionSetBuilderDependencies

Methods

Create(IModel)

Creates an optimized model base on the supplied one.

protected virtual RuntimeModel Create(IModel model)

Parameters

model IModel

The source model.

Returns

RuntimeModel

An optimized model.

GetForeignKey(IForeignKey, RuntimeEntityType)

Gets the corresponding foreign key in the read-optimized model.

protected virtual RuntimeForeignKey GetForeignKey(IForeignKey foreignKey, RuntimeEntityType entityType)

Parameters

foreignKey IForeignKey

The original foreign key.

entityType RuntimeEntityType

The declaring entity type.

Returns

RuntimeForeignKey

The corresponding read-optimized foreign key.

GetIndex(IIndex, RuntimeEntityType)

Gets the corresponding index in the read-optimized model.

protected virtual RuntimeIndex GetIndex(IIndex index, RuntimeEntityType entityType)

Parameters

index IIndex

The original index.

entityType RuntimeEntityType

The declaring entity type.

Returns

RuntimeIndex

The corresponding read-optimized index.

GetKey(IKey, RuntimeEntityType)

Gets the corresponding key in the read-optimized model.

protected virtual RuntimeKey GetKey(IKey key, RuntimeEntityType entityType)

Parameters

key IKey

The original key.

entityType RuntimeEntityType

The declaring entity type.

Returns

RuntimeKey

The corresponding read-optimized key.

ProcessComplexPropertyAnnotations(Dictionary<string, object?>, IComplexProperty, RuntimeComplexProperty, bool)

Updates the property annotations that will be set on the read-only object.

protected virtual void ProcessComplexPropertyAnnotations(Dictionary<string, object?> annotations, IComplexProperty property, RuntimeComplexProperty runtimeProperty, bool runtime)

Parameters

annotations Dictionary<string, object>

The annotations to be processed.

property IComplexProperty

The source property.

runtimeProperty RuntimeComplexProperty

The target property that will contain the annotations.

runtime bool

Indicates whether the given annotations are runtime annotations.

ProcessElementTypeAnnotations(Dictionary<string, object?>, IElementType, RuntimeElementType, bool)

Updates the element type annotations that will be set on the read-only object.

protected virtual void ProcessElementTypeAnnotations(Dictionary<string, object?> annotations, IElementType element, RuntimeElementType runtimeElement, bool runtime)

Parameters

annotations Dictionary<string, object>

The annotations to be processed.

element IElementType

The source element type.

runtimeElement RuntimeElementType

The target element type that will contain the annotations.

runtime bool

Indicates whether the given annotations are runtime annotations.

ProcessEntityTypeAnnotations(Dictionary<string, object?>, IEntityType, RuntimeEntityType, bool)

Updates the entity type annotations that will be set on the read-only object.

protected virtual void ProcessEntityTypeAnnotations(Dictionary<string, object?> annotations, IEntityType entityType, RuntimeEntityType runtimeEntityType, bool runtime)

Parameters

annotations Dictionary<string, object>

The annotations to be processed.

entityType IEntityType

The source entity type.

runtimeEntityType RuntimeEntityType

The target entity type that will contain the annotations.

runtime bool

Indicates whether the given annotations are runtime annotations.

ProcessForeignKeyAnnotations(Dictionary<string, object?>, IForeignKey, RuntimeForeignKey, bool)

Updates the foreign key annotations that will be set on the read-only object.

protected virtual void ProcessForeignKeyAnnotations(Dictionary<string, object?> annotations, IForeignKey foreignKey, RuntimeForeignKey runtimeForeignKey, bool runtime)

Parameters

annotations Dictionary<string, object>

The annotations to be processed.

foreignKey IForeignKey

The source foreign key.

runtimeForeignKey RuntimeForeignKey

The target foreign key that will contain the annotations.

runtime bool

Indicates whether the given annotations are runtime annotations.

ProcessIndexAnnotations(Dictionary<string, object?>, IIndex, RuntimeIndex, bool)

Updates the index annotations that will be set on the read-only object.

protected virtual void ProcessIndexAnnotations(Dictionary<string, object?> annotations, IIndex index, RuntimeIndex runtimeIndex, bool runtime)

Parameters

annotations Dictionary<string, object>

The annotations to be processed.

index IIndex

The source index.

runtimeIndex RuntimeIndex

The target index that will contain the annotations.

runtime bool

Indicates whether the given annotations are runtime annotations.

ProcessKeyAnnotations(Dictionary<string, object?>, IKey, RuntimeKey, bool)

Updates the key annotations that will be set on the read-only object.

protected virtual void ProcessKeyAnnotations(Dictionary<string, object?> annotations, IKey key, RuntimeKey runtimeKey, bool runtime)

Parameters

annotations Dictionary<string, object>

The annotations to be processed.

key IKey

The source key.

runtimeKey RuntimeKey

The target key that will contain the annotations.

runtime bool

Indicates whether the given annotations are runtime annotations.

ProcessModelAnnotations(Dictionary<string, object?>, IModel, RuntimeModel, bool)

Updates the model annotations that will be set on the read-only object.

protected virtual void ProcessModelAnnotations(Dictionary<string, object?> annotations, IModel model, RuntimeModel runtimeModel, bool runtime)

Parameters

annotations Dictionary<string, object>

The annotations to be processed.

model IModel

The source model.

runtimeModel RuntimeModel

The target model that will contain the annotations.

runtime bool

Indicates whether the given annotations are runtime annotations.

ProcessModelFinalized(IModel)

public virtual IModel ProcessModelFinalized(IModel model)

Parameters

model IModel

Returns

IModel

ProcessNavigationAnnotations(Dictionary<string, object?>, INavigation, RuntimeNavigation, bool)

Updates the navigation annotations that will be set on the read-only object.

protected virtual void ProcessNavigationAnnotations(Dictionary<string, object?> annotations, INavigation navigation, RuntimeNavigation runtimeNavigation, bool runtime)

Parameters

annotations Dictionary<string, object>

The annotations to be processed.

navigation INavigation

The source navigation.

runtimeNavigation RuntimeNavigation

The target navigation that will contain the annotations.

runtime bool

Indicates whether the given annotations are runtime annotations.

ProcessPropertyAnnotations(Dictionary<string, object?>, IProperty, RuntimeProperty, bool)

Updates the property annotations that will be set on the read-only object.

protected virtual void ProcessPropertyAnnotations(Dictionary<string, object?> annotations, IProperty property, RuntimeProperty runtimeProperty, bool runtime)

Parameters

annotations Dictionary<string, object>

The annotations to be processed.

property IProperty

The source property.

runtimeProperty RuntimeProperty

The target property that will contain the annotations.

runtime bool

Indicates whether the given annotations are runtime annotations.

ProcessServicePropertyAnnotations(Dictionary<string, object?>, IServiceProperty, RuntimeServiceProperty, bool)

Updates the service property annotations that will be set on the read-only object.

protected virtual void ProcessServicePropertyAnnotations(Dictionary<string, object?> annotations, IServiceProperty property, RuntimeServiceProperty runtimeProperty, bool runtime)

Parameters

annotations Dictionary<string, object>

The annotations to be processed.

property IServiceProperty

The source service property.

runtimeProperty RuntimeServiceProperty

The target service property that will contain the annotations.

runtime bool

Indicates whether the given annotations are runtime annotations.

ProcessSkipNavigationAnnotations(Dictionary<string, object?>, ISkipNavigation, RuntimeSkipNavigation, bool)

Updates the skip navigation annotations that will be set on the read-only object.

protected virtual void ProcessSkipNavigationAnnotations(Dictionary<string, object?> annotations, ISkipNavigation skipNavigation, RuntimeSkipNavigation runtimeSkipNavigation, bool runtime)

Parameters

annotations Dictionary<string, object>

The annotations to be processed.

skipNavigation ISkipNavigation

The source skip navigation.

runtimeSkipNavigation RuntimeSkipNavigation

The target skip navigation that will contain the annotations.

runtime bool

Indicates whether the given annotations are runtime annotations.

ProcessTriggerAnnotations(Dictionary<string, object?>, ITrigger, RuntimeTrigger, bool)

Updates the trigger annotations that will be set on the read-only object.

protected virtual void ProcessTriggerAnnotations(Dictionary<string, object?> annotations, ITrigger trigger, RuntimeTrigger runtimeTrigger, bool runtime)

Parameters

annotations Dictionary<string, object>

The annotations to be processed.

trigger ITrigger

The source trigger.

runtimeTrigger RuntimeTrigger

The target trigger that will contain the annotations.

runtime bool

Indicates whether the given annotations are runtime annotations.

ProcessTypeMappingConfigurationAnnotations(Dictionary<string, object?>, ITypeMappingConfiguration, RuntimeTypeMappingConfiguration, bool)

Updates the property annotations that will be set on the read-only object.

protected virtual void ProcessTypeMappingConfigurationAnnotations(Dictionary<string, object?> annotations, ITypeMappingConfiguration typeConfiguration, RuntimeTypeMappingConfiguration runtimeTypeConfiguration, bool runtime)

Parameters

annotations Dictionary<string, object>

The annotations to be processed.

typeConfiguration ITypeMappingConfiguration

The source property.

runtimeTypeConfiguration RuntimeTypeMappingConfiguration

The target property that will contain the annotations.

runtime bool

Indicates whether the given annotations are runtime annotations.