I'm trying to run the add-migration command for my database context and for some reason it's trying to do a select on a table that doesn't even exist yet (running on an empty database). The command I'm running is:
Add-Migration -context MyDbContext MyDb-1.0
I immediately get an error:
An error occurred while calling method 'BuildWebHost' on class 'Program'. Continuing without the application service provider. Error: Invalid object name 'AccountTypes'.
Looking at the stacktrace I see the command was trying to do a select statement on a non-existing (yet) table:
fail: Microsoft.EntityFrameworkCore.Database.Command Failed executing DbCommand (27ms) [Parameters=[@__value_0='?'], CommandType='Text', CommandTimeout='30'] SELECT TOP(1) [p].[Id], [p].[AccountType] FROM [AccountTypes] AS [p] WHERE [p].[Id] = @__value_0
Not sure what is going on here. I'm using ASP.NET core 2.0 with EF core 2.0. I didn't have a problem doing this with core < 2.0.
For those who are interested: https://github.com/aspnet/EntityFrameworkCore/issues/9625