Collection navigation properties and fields in EF Core 1.1

There has recently been some confusion about what mappings are supported for collection navigation properties in EF Core. This post is an attempt to clear things up by showing:

  • What types of collection are supported
  • When the backing field can be used directly

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