Skip to content

DevExpress-Examples/asp-net-core-reporting-ef-context

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reporting for ASP.NET Core - Resolve the Entity Framework Core Context from the DI Container

The following example obtains Entity Framework Core context from an ASP.NET Core dependency injection container.

  1. Implement the IEFContextProvider and IEFContextProviderFactory interfaces (CustomEFContextProvider and CustomEFContextProviderFactory classes in this example) to create a service that allows you to obtain EF Core Context.

  2. Register the context in the dependency injection container. Call the AddDbContext method in the ConfigureServices method of the Startup class to specify the required connection string.

  3. Use the ConfigureServices method of the Startup class to register the factory implementation.

Files to Review

Documentation

About

The following example shows how to obtain the Entity Framework Core context from the ASP.NET Core dependency injection container.

Topics

Resources

License

Stars

Watchers

Forks