command-line-api icon indicating copy to clipboard operation
command-line-api copied to clipboard

EF Core database migrations do not work after referencing DragonFruit

Open jussimattila opened this issue 7 years ago • 0 comments

I added a few database maintenance commands to my ASP.NET Core application using DragonFruit and really liked the approach. Unfortunately, I had to remove the reference since EF Core migrations would not work anymore.

With DragonFruit installed, I would get this error: Unable to create an object of type 'SuiteContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728. This is most probably an issue with EF Core not finding the CreateWebHostBuilder or BuildWebHost method at design time after DragonFruit has generated a new Main method in the assembly. These methods are used at design time for accessing a configured DbContext while performing migrations.

Providing an implementation of IDesignTimeDbContextFactory would have helped, but it would have been hard to configure correctly in our case, so I ended up removing the dependency instead.

jussimattila avatar Aug 15 '19 06:08 jussimattila