The following example obtains Entity Framework Core context from an ASP.NET Core dependency injection container.
-
Implement the
IEFContextProviderinterface (CustomEFContextProviderclass in this example) to create a service that allows you to get the EF Core Context. -
Call the IEFContextProvider.GetContext(String, Type) method to return a context for the specified data source.
-
Call the AddDbContext method to register the context in the dependency injection container and specify the required connection string in the
WebApplicationBuilderclass. -
In the
WebApplicationBuilderclass, register the DashboardConfigurator service and configure it using the SetEFContextProvider(IEFContextProvider) method.
(you will be redirected to DevExpress.com to submit your response)