Perhaps Visual Studio does not know which connection string to use for your DBC context when you select the menu commands of the Entity Framework.
In my case, I was able to solve this by checking that I had a default connection string for my dbContext. So, when you right-click on the db context and select the Entity framework, you will have a database connection.
In other words, I modified my DBContext to select the connection string from the command line parameter in my application. So, as a rule, my db context did not have a default value.
public class MyDbContext : DbContext { public static string ConnectionName; public DnnDbContext() : base( "Name=" + ConnectionName) { }
As you can see, I did not have a ConnectionString by default.
I changed to:
public static string ConnectionName = "DefaultConnNameInAppConfig";
source share