scaffolding (database first) EF Core table with no primary key

Viewed 1984

I am using EF core 2.0 and using scaffolding reverse engineering database first to generate models.

some of tables does not have any primary key and EF Unable to generate entity type for table.

Any advice how can I do this other then adding manually.

2 Answers

So far either Entity Framework or Entity Framework Core does not support generating table from EF/EF Core model class without primary key.

But this is a requested feature in Entity Framework Core. Here is the details about it:

Allow code generation for tables without a primary key

You could upgrade to EF core 3.0 which is currently in preview, that is now possible.

Related