Table of Contents

Class ProviderConventionSetBuilder

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

A service on the EF internal service provider that creates the ConventionSet for the current database provider. This is combined with IConventionSetPlugin instances to produce the full convention set exposed by the IConventionSetBuilder service.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

public class ProviderConventionSetBuilder : IProviderConventionSetBuilder
Inheritance
ProviderConventionSetBuilder
Implements
Inherited Members

Remarks

Database providers should implement this service by inheriting from either this class (for non-relational providers) or `RelationalConventionSetBuilder` (for relational providers).

The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

See Model building conventions for more information and examples.

Constructors

ProviderConventionSetBuilder(ProviderConventionSetBuilderDependencies)

Initializes a new instance of the ProviderConventionSetBuilder class.

public ProviderConventionSetBuilder(ProviderConventionSetBuilderDependencies dependencies)

Parameters

dependencies ProviderConventionSetBuilderDependencies

Parameter object containing dependencies for this service.

Properties

Dependencies

Dependencies for this service.

protected virtual ProviderConventionSetBuilderDependencies Dependencies { get; }

Property Value

ProviderConventionSetBuilderDependencies

Methods

CreateConventionSet()

Builds and returns the convention set for the current database provider.

public virtual ConventionSet CreateConventionSet()

Returns

ConventionSet

The convention set for the current database provider.

ReplaceConvention<TConvention, TImplementation>(List<TConvention>, TImplementation)

Replaces an existing convention with a derived convention.

protected virtual bool ReplaceConvention<TConvention, TImplementation>(List<TConvention> conventionsList, TImplementation newConvention) where TImplementation : TConvention

Parameters

conventionsList List<TConvention>

The list of existing convention instances to scan.

newConvention TImplementation

The new convention.

Returns

bool

Type Parameters

TConvention

The type of convention being replaced.

TImplementation

The type of the old convention.