EntityFramework.Docs icon indicating copy to clipboard operation
EntityFramework.Docs copied to clipboard

Subclassing an Existing DbContext for an Alternate Provider Causes Compilation Errors

Open iUnknwn opened this issue 4 years ago • 1 comments

In Entity Framework Core 3.1, when subclassing an existing DbContext, it will generate an error if you're missing a constructor:

public MySqliteContext(DbContextOptions<MySqliteContext> options) : base(options)

However, this will type error, because the constructor of the base class is expecting type DbContextOptions<MyContext> for options, not DbContextOptions<MySqliteContext>.

This is discussed an in this issue, and the work around is to add a protected constructor in the base class. https://github.com/dotnet/efcore/issues/7533#issuecomment-353669263


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

iUnknwn avatar Apr 14 '20 00:04 iUnknwn