The following example obtains Entity Framework Core context from an ASP.NET Core dependency injection container.
-
Implement the
IEFContextProvider
interface (CustomEFContextProvider
class 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
WebApplicationBuilder
class. -
In the
WebApplicationBuilder
class, register the DashboardConfigurator service and configure it using the SetEFContextProvider(IEFContextProvider) method.
(you will be redirected to DevExpress.com to submit your response)