Implementing a provider “Use…” method for EF Core 1.1

The previous post contained lots of information about how dependency injection works with database providers. This post adds more to the provider story by explaining how to implement a method like UseSqlServer that allows applications to select the provider to use.

Continue reading

Advertisements

Dependency Injection in EF Core 1.1

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.

Continue reading

EF Core 1.1 – Creating DbContext instances

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

Continue reading