No database providers are configured EF7

asp.net-core asp.net-core-mvc c# entity-framework entity-framework-core

Accepted Answer

ZZZ_tmp
26
10/11/2015 11:14:07 PM

Popular Answer

I think the line where you were attempting to access some database data is where you encountered this problem. This issue may be fixed by clarifying your context. Simply replace the OnConfiguring method.

public class MyDbContext : DbContext
{
    public DbSet<Employee> Employees { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder options)
    {
        options.UseSqlServer("<your connection string>");
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        ...
    }
}


Related Questions





Related

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