The following example obtains Entity Framework Core context from an ASP.NET Core dependency injection container.
-
Implement the IEFContextProvider and IEFContextProviderFactory interfaces (
CustomEFContextProvider
andCustomEFContextProviderFactory
classes in this example) to create a service that allows you to obtain EF Core Context. -
Register the context in the dependency injection container. Call the AddDbContext method in the
ConfigureServices
method of theStartup
class to specify the required connection string. -
Use the
ConfigureServices
method of theStartup
class to register the factory implementation.
(you will be redirected to DevExpress.com to submit your response)