DbConfiguration.Loaded Event

Definition

Occurs during EF initialization after the DbConfiguration has been constructed but just before it is locked ready for use. Use this event to inspect and/or override services that have been registered before the configuration is locked. Note that this event should be used carefully since it may prevent tooling from discovering the same configuration that is used at runtime.

public static event EventHandler<System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationLoadedEventArgs> Loaded;
member this.Loaded : EventHandler<System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationLoadedEventArgs> 
Public Shared Custom Event Loaded As EventHandler(Of DbConfigurationLoadedEventArgs) 

Event Type

Remarks

Handlers can only be added before EF starts to use the configuration and so handlers should generally be added as part of application initialization. Do not access the DbConfiguration static methods inside the handler; instead use the the members of DbConfigurationLoadedEventArgs to get current services and/or add overrides.

Applies to