Writing a database provider for EF Core can be daunting. I have written several posts over the last month containing information you need to know when writing a provider. This post pulls all that together to give an overview of the different building blocks with links to previous posts containing the details.
A previous post gave an overview of how dependency injection is used internally by EF Core, and how applications might interact with this. In this post we will look at some of the internal details. This post is aimed at provider writers and people who may want to contribute to the EF source code. Application developers should not need to know any of this.
EF Core can interact with dependency injection (D.I.) in two ways:
- A D.I. container can be used to create DbContext instances
- EF uses a D.I. container internally for its own services
The first of these was covered in a previous post. This post covers how EF uses dependency injection internally and how it can interact with an external container.
This post describes the different ways to create and configure instances of DbContext in EF Core 1.1. This includes:
- Calling a constructor directly and overriding OnConfiguring
- Passing DbContextOptions to the constructor
- Using Dependency Injection (D.I.) to create instances