Entity Framework Core 2 – Breaking changes and obsolescence


Entity Framework Core 2 was released on August 14th. It brought new features.

On this article I will explain : Breaking changes and obsolete features

The IDbContextFacfory<T> interface was replaced by IDesignTimeDbContextFactory<T>.

This interface is required when you want to add new migration and update database.


public class AdventureWorksContextScaffoldedFactory : IDesignTimeDbContextFactory<AdventureWorksContext>
   public AdventureWorksContext CreateDbContext(string[] args)
      var builder = new DbContextOptionsBuilder<AdventureWorksContext>();
      return new AdventureWorksContext(builder.Options);

The extension method UseMemoryDatabase has changed

Now it’s strongly recommanded to use the signature with an in memory database name, because you may have issues if you use multiple databases in memory.


var serviceProvider = new ServiceCollection()
    options =>
 .AddScoped<IEfQueries, EfQueries>()

If you don’t use the signature with a name, you will get an “obsolete” warning:

Other changes

Package Microsoft.EntityFrameworkCore.SqlServer.Design is deprecated in favor of Microsoft.EntityFrameworkCore.Design(now provider-agnostic).

Only 2.0 providers will work, so any existing providers that target EF Core 1.x will need to be rewritten.

Logging event IDs have changed from the previous version and they are now identical to those used by corresponding ILogger messages. The logger categories now come from subclasses of DbLoggerCategory, such as DbLoggerCategory.Database.CommandDbLoggerCategory.MigrationsDbLoggerCategory.Infrastructure, etc, all of which offer a Name property.

Written by


Anthony is a specialist in Web technologies (14 years of experience), in particular Microsoft .NET and learns the Cloud Azure platform. He has received twice the Microsoft MVP award and he is also certified Microsoft MCSD and Azure Fundamentals.
%d bloggers like this: