Monday, February 29, 2016

The target context 'MyDbContext' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory.

I was recently using Code First Migrations with Entity Framework and I was using the Enable-Migrations command when I suddenly encountered this error message:

The target context 'MyDbContext' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory.

As it turned out, I was missing a default constructor in my DbContext implementation that was preventing the running of this command.

As soon as I added this back in, I was able to run my migration command!


No comments:

Post a Comment