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

EntityFromContext EF Core - entities without primary key error #596

Open
lucascaser opened this issue Jun 17, 2023 · 0 comments
Open

EntityFromContext EF Core - entities without primary key error #596

lucascaser opened this issue Jun 17, 2023 · 0 comments

Comments

@lucascaser
Copy link

Hello,

I have a .NET core project that has database views mapped to the entity framework and these have the builder.HasNoKey(); configuration, as they are used only for queries.
Besides, I'm using the EntityFromContext() method, but it wasn't handled in case the entity doesn't have a primary key.
image
It is possible to see that there was no treatment, if the .FindPrimaryKey() == null, generating the error of object reference not set to an instance of an object.

Therefore, I opened a PR dealing with this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant