Table of Contents

Class EntityFrameworkRelationalServicesBuilder

Namespace
Microsoft.EntityFrameworkCore.Infrastructure
Assembly
Microsoft.EntityFrameworkCore.Relational.dll

A builder API designed for relational database providers to use when registering services.

Providers should create an instance of this class, use its methods to register services, and then call TryAddCoreServices() to fill out the remaining Entity Framework services.

Entity Framework ensures that services are registered with the appropriate scope. In some cases a provider may register a service with a different scope, but great care must be taken that all its dependencies can handle the new scope, and that it does not cause issue for services that depend on it.

public class EntityFrameworkRelationalServicesBuilder : EntityFrameworkServicesBuilder
Inheritance
EntityFrameworkRelationalServicesBuilder

Constructors

EntityFrameworkRelationalServicesBuilder(IServiceCollection)

Used by relational database providers to create a new EntityFrameworkRelationalServicesBuilder for registration of provider services.

public EntityFrameworkRelationalServicesBuilder(IServiceCollection serviceCollection)

Parameters

serviceCollection IServiceCollection

The collection to which services will be registered.

Fields

RelationalServices

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

This dictionary is exposed for testing and provider-validation only. It should not be used from application code.

public static readonly IDictionary<Type, ServiceCharacteristics> RelationalServices

Field Value

IDictionary<Type, ServiceCharacteristics>

Methods

GetServiceCharacteristics(Type)

Gets the Microsoft.EntityFrameworkCore.Infrastructure.ServiceCharacteristics for the given service type.

protected override ServiceCharacteristics GetServiceCharacteristics(Type serviceType)

Parameters

serviceType Type

The type that defines the service API.

Returns

ServiceCharacteristics

The Microsoft.EntityFrameworkCore.Infrastructure.ServiceCharacteristics for the type.

Exceptions

InvalidOperationException

when the type is not an EF service.

TryAddCoreServices()

Registers default implementations of all services, including relational services, not already registered by the provider. Relational database providers must call this method as the last step of service registration--that is, after all provider services have been registered.

public override EntityFrameworkServicesBuilder TryAddCoreServices()

Returns

EntityFrameworkServicesBuilder

This builder, such that further calls can be chained.