EntityFrameworkServicesBuilder Class

Definition

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

public class EntityFrameworkServicesBuilder : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.Extensions.DependencyInjection.IServiceCollection>
public class EntityFrameworkServicesBuilder
type EntityFrameworkServicesBuilder = class
    interface IInfrastructure<IServiceCollection>
type EntityFrameworkServicesBuilder = class
Public Class EntityFrameworkServicesBuilder
Implements IInfrastructure(Of IServiceCollection)
Public Class EntityFrameworkServicesBuilder
Inheritance
EntityFrameworkServicesBuilder
Derived
Implements

Remarks

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.

Relational providers should use 'EntityFrameworkRelationalServicesBuilder instead.

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.

See Implementation of database providers and extensions for more information and examples.

Constructors

EntityFrameworkServicesBuilder(IServiceCollection)

Used by database providers to create a new EntityFrameworkServicesBuilder for registration of provider services. Relational providers should use 'EntityFrameworkRelationalServicesBuilder'.

Fields

CoreServices

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.

Properties

ServiceCollectionMap

Access to the underlying ServiceCollectionMap.

Methods

GetServiceCharacteristics(Type)

Gets the ServiceCharacteristics for the given service type.

TryAdd(Type, Object)

Adds an implementation of an Entity Framework service only if one has not already been registered. This method can only be used for singleton services.

TryAdd(Type, Type)

Adds an implementation of an Entity Framework service only if one has not already been registered. The scope of the service is automatically defined by Entity Framework.

TryAdd(Type, Type, Func<IServiceProvider,Object>)

Adds a factory for an Entity Framework service only if one has not already been registered. The scope of the service is automatically defined by Entity Framework.

TryAdd<TService,TImplementation>()

Adds an implementation of an Entity Framework service only if one has not already been registered. The scope of the service is automatically defined by Entity Framework.

TryAdd<TService,TImplementation>(Func<IServiceProvider,TImplementation>)

Adds a factory for an Entity Framework service only if one has not already been registered. The scope of the service is automatically defined by Entity Framework.

TryAdd<TService>(Func<IServiceProvider,TService>)

Adds a factory for an Entity Framework service only if one has not already been registered. The scope of the service is automatically defined by Entity Framework.

TryAdd<TService>(TService)

Adds an implementation of an Entity Framework service only if one has not already been registered. This method can only be used for singleton services.

TryAddCoreServices()

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

TryAddProviderSpecificServices(Action<ServiceCollectionMap>)

Database providers should call this method for access to the underlying ServiceCollectionMap such that provider-specific services can be registered. Note that implementations of Entity Framework services should be registered directly on the EntityFrameworkServicesBuilder and not through this method.

TryGetServiceCharacteristics(Type)

Gets the ServiceCharacteristics for the given service type.

Explicit Interface Implementations

IInfrastructure<IServiceCollection>.Instance

Gets the IServiceCollection being configured.

This property is intended for use by extension methods that need to make use of services not directly exposed in the public API surface.

Extension Methods

GetInfrastructure<T>(IInfrastructure<T>)

Gets the value from a property that is being hidden using IInfrastructure<T>.

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

Applies to