ErikEJ / EntityFramework6PowerTools

This is the codebase for Entity Framework 6 Power Tools Community Edition, and modern EF 6 providers for SQL Server and SQL Server Compact
Other
183 stars 27 forks source link

Error generating models with VS2019 and EF6: A constructible type deriving.... #70

Closed pafuco closed 4 years ago

pafuco commented 4 years ago

I use VS2019 and EF6. When I select any option from the menu to generate a model, I got the error "A constructible type deriving from DbContext could not be found in the selected file".

This an example of a DbContext Class

public class StoreContext : DbContext {
public StoreContext(DbContextOptions options) : base(options) {

    }

    public DbSet<Computer> Computers { get; set; }
    public DbSet<Allocation> Allocations { get; set; }
    public DbSet<Component> Components { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Component>().ToTable("Component");
        modelBuilder.Entity<Allocation>().ToTable("Allocation");
        modelBuilder.Entity<Computer>().ToTable("Computer");
    }
}
ErikEJ commented 4 years ago

That does not look like a EF6 DbContext, that looks like a EF Core DbContext !?

pafuco commented 4 years ago

Thanks Erik for your clarification, it is right. Then I guess that in this case the correct would have been to use EF Core Power Tools.

ErikEJ commented 4 years ago

Yes!