Design a site like this with
Get started

The entity type ‘DisplayDetails’ requires a primary key to be defined. If you intended to use a keyless entity type, call ‘HasNoKey’ in ‘OnModelCreating’. For more information on keyless entity types, see


If you intend to create a table without a primary key in the database just add [Keyless] before class name

as follows:

public class DisplayDetails

You might come across the error when you add “keyless” that is because you also need to add this using statement:

using Microsoft.EntityFrameworkCore;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a free website or blog at

Up ↑

%d bloggers like this: