user7127000
user7127000

Reputation: 3243

Alternatives to Scaffold-DbContext for generating entity types

I'm trying to make an ASP.NET Core application that uses LINQ-to-SQL and, preferably, uses a tool to generate the classes. I've followed the steps of different tutorials like https://code.msdn.microsoft.com/How-to-using-Entity-1464feea and whenever I run Scaffold-DbContext I get a data context generated but no entities. Instead I get the error

    // Unable to generate entity type for table 'dbo.MyTable'. Please see the warning messages.

for every one of my tables. There's nothing "weird" about my database, and the warning messages don't exist. Therefore I'm wondering if there's an alternative way to generate the entities.

Upvotes: 0

Views: 1015

Answers (1)

ErikEJ
ErikEJ

Reputation: 41819

Scaffold-DbContext requires your tables to have primary keys!

Upvotes: 1

Related Questions