How to cope with "No data stores are configured"?



I am currently playing with beta4 of EF7 using the blank ASP.NET web project template.

After having kicked off the existing migration, resulting in the tables being created in the localdb, the following occurs:

Strangely, when I clean up the migration-folder, including removing ApplicationDbContextModelSnapshot.cs and I run dnx . ef migration add twice, I get the following error:

dnx : 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 second migration is not created. When I review the created migration it contains all tables whereas the database is already provisioned, so you should expect the migration being empty.

Then, when I remove the first migration and run the add migration command again more than once, all the migrations are correctly created, i.e. as empty files.

Can someone explain this to me? Is this expected behavior or is this a bug in beta4?

Tip for people coming from former EF-versions: * Don't use the K command framework anymore. * Don't use the Add-Migration cmdlets anymore. Both have been replaced by dnx . (dot). (dnx = .NET execution environment)

Some references:,-2014

6/20/2015 1:08:09 PM

Popular Answer

Remove the constructor of ApplicationContext. It is a temporary workaround to enable deployment, but it interferes with the Migrations commands.

6/20/2015 2:20:01 PM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow