Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to setting a model with table don't have any primary key column? #9517

Closed
ndphuong opened this issue Aug 22, 2017 · 3 comments
Closed

How to setting a model with table don't have any primary key column? #9517

ndphuong opened this issue Aug 22, 2017 · 3 comments

Comments

@ndphuong
Copy link

The EFCore throw exception: The entity type XXX requires a primary key to be defined
But our table don't have any primary key column

How to avoid this ?

@ajcvickers
Copy link
Member

@ndphuong EF Core requires all mapped entity types to have a primary key defined. This is needed so that different entity instances can be uniquely identified for tracking.

Can you provide some details of what you are trying to do so we might be able to give some advice on how to approach it.

@ndphuong
Copy link
Author

@ajcvickers
We are using EFCore to try access a read-only database
Some table don't have any primary key column so EF throws exception

@ajcvickers
Copy link
Member

@ndphuong This is covered by #9290 and #1862 may also have useful information for you.

Closing this as a duplicate of #9290

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants