Øyvind Vik
Øyvind Vik

Reputation: 6287

Configuring the DbContext in MVC6 for Scaffolding

I am using the new code generator to scaffold standard CRUD controller and views with the new ASP.NET 5 and MVC6. When running the dnx . gen controller command I get the following error message:

Attempting to figure out the EntityFramework metadata for the model and DbContext There was an error creating the DbContext instance to get the model: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: No data stores are configured. Configure a data store by overriding OnConfiguring in your DbContext class or in the AddDbContext method when setting up services.

The startup.cs file already has the code that adds the DBContext in the ConfigureServices option, so I am at a loss for how to get this to work.

Upvotes: 2

Views: 1151

Answers (1)

Related Questions